Jonathan Underwood <jonathan.underwood <at> gmail.com> writes: > I am trying to connect to machine C via a tunnel to machine B from > machine A, with machine A being the local machine. > > Machine C is behind a firewall, and so direct ssh from A to C isn't possible. > > At the command line, once ssh'd into machine B from machine A, I can > ssh from machine B to machine A. > > So, on machine A (local machine) I run in one terminal (Terminal 1): > > ssh -R 8888:C:22 username <at> B cat - > > which asks me for my password on machine B, which I duly enter. > > Then, on machine A, in a second terminal (Terminal 2) I run > > ssh -p 8888 localhost I had a similar problem a few months ago which took me some time to fathom the solution needed. I found the following for my case: 1) From machine A do "ssh -L 12345:C:5900 B" (where B and C are your machine names in question) in a first terminal window. This allows an ssh login from A to machine B where the firewall is, but once connected is set up to forward in this case port 12345 from the originating machine A to port 5900 on machine C. Once connected to machine B, then login to machine C on the standard ssh port. Now the tunnel should be set up with the correct port forwarding that you want - in this case anything going to poert 12345 on machine A will be forwarded through to 5900 on machine C which is the standard vnc port. 2) Once this is running then start the vnc connection command in a second terminal session on machine A going to port 12345, and this will then have the vnc command running and communicating to port 5900 (default) on machine C via the tunnel. It did take me quite some time to work this out, but it has worked consistently ever since.