0

I have a situation where I have a Windows 10 virtual machine running under VirtualBox on my linux desktop. This virtual machine (and at the moment only this virtual machine) can establish a VPN tunnel to a remote office.

I currently have a small raspberry pi - which is currently sitting on my local network which I regularly ssh into from my linux desktop, and which I can also, once ssh'ed in can ssh from the pi back to my linux desktop to pull from a git repository. I can also ssh from my windows machine into the pi (using git bash).

What this implies is that both linux and pi run sshd, but windows doesn't

I am shortly going to move the pi to this remote office, and I would like to set up a situation where I can ssh to and from the pi in this location and my linux desktop.

So my thought was to set up a ssh tunnel using the windows client. So as an experiment still all in my local environment on the windows machine I did

ssh -L 9001:pi:22 pi@pi (for this example pi is also the local user on the pi). I assumed that this would forward traffic from port 9001 to the sshd server on the pi.

Then on my linux desktop I did ssh -l pi -p 9001 win in the expectation that I would now ssh into the pi.

But it just hung.

What am I doing wrong?

1

Can you successfully do ssh -l pi -p 9001 win from your windows box? And if you try ssh -l pi -p 9001 127.0.0.1?

If you can do the latter but cannot do the same from the linux box, the problem may be that you are listening on port 9001 only on the local side. Please look at the man page for ssh, specifically the description of -L [bind_address:]port:host:hostport. To listen to port 9001 also on the public side, you can set up your tunnel as follows: ssh -L *:9001:pi:22 pi@pi.

  • This was the issue precisely. The first command I did on the windows box had bound to localhost only, and not to the outside interfaces. As soon as I added the *: at the beginning of the -L option Windows Firewall popped up and asked if I wanted to allow an exception (which I did) and then access from my linux box worked perfectly – akc42 Mar 3 '16 at 8:56
0

If I read correctly, you want to SSH from host A to host C by way of an SSH daemon running on host B?

This can be accomplished with some minor magic in the .ssh/config file on host A:

Host hostc
   HostName hostb
   ProxyCommand ssh username@hostc nc %h %p 2>/dev/null

With this stanza in your .ssh/config on host A, you can ssh hostc and you will be proxied through a connection on host B.

If host A is your Windows box, cygwin's openSSH client can do this; I am not aware of how to replicate this in e. g. PuTTY.

  • You have what I am trying to slightly wrong. Host A is the linux box, host B is the Windows box and host C is the raspberry pi. But this means that host B does NOT contain a ssh daemon. I was trying to create the equivalent by running ssh client on host B with the ssh -L 9001 ... command – akc42 Feb 25 '16 at 22:07
  • This might be deer hunting with a howitzer, but you can install an SSH daemon on the Windows box as part of a Cygwin installation. – DopeGhoti Feb 25 '16 at 22:57

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.