0

Here is the situation: I have a Windows home machine Home which I can connect to Foo, a Unix server via ssh. Then I can ssh from my Unix work machine Bar to this same server Foo.

Windows           Unix             Unix
  __               __     ssh       __
 |  | ----------> |  | <---------- |  |
 |__|    ssh      |__| ----------> |__|
 Home             Foo     ssh -R    Bar

My first goal is to be able to open a ssh-shell on Bar from Home (I use putty on Windows). My understanding is that I have to open a reverse ssh tunnel from Bar choosing an arbitrary port say 2210.

netstat -putan

displays:

Bar.x.x.ip:2210
127.0.0.1:2210
::1:2210

Then I don't know how from Home I can open a terminal to Bar.

My second and last problem is that I want (using scp) to copy files from Foo to Bar while typing on Home, like I would naturally do it but typing on Bar.

Is it possible to guide into the procedure to make this work? Thanks

  • What client do you have on windows? putty? cygwin? – ott-- Aug 28 '15 at 18:50
  • I use putty on Windows – leag Aug 28 '15 at 20:01
1

If I read your question correct you are not able to ssh from Foo to Bar, otherwise it would be as easy as:

win> ssh -L 2210:bar:22 user@foo

Where you probably replace ssh with PuTTY and setup the correct tunnel, but this will hopefully illustrate the way you should set it up...

Then you can start a ssh session to bar using:

win> ssh -p 2210 bar-user@localhost

If you can only ssh from Bar to Foo you first need to setup a tunnel from Bar to Foo using:

bar# ssh -R 2210:localhost:22 user@foo

If this connection is up you can start a connection from Windows to Foo using:

win> ssh -L 2210:localhost:2210 user@foo

This way you have both sides connected to Foo and you should be able to start a connection using:

win> ssh -p 2210 bar-user@localhost

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.