VNC connection via SSH proxy machine

I would like to make a VNC connection from home to a Windows machine at work. The Windows machine is not accessible from the outside, but there is a Linux box that does have port 22 open, so it would seem that this can be done.

I suspect it's just a command that "forwards" connections to port 22 on the Linux machine to the Windows machine? Just can't find an example that does exactly this though

Thanks in advance!


Solution 1:

ssh -L 5902:[vnc host]:5901 [ssh host]

then: vncviewer localhost:2

from: http://www.cl.cam.ac.uk/research/dtg/attarchive/vnc/sshvnc.html

Solution 2:

If you're connecting from a Linux machine at home, you can simply use the '-via' flag on vncviewer, like this:

vncviewer host-at-work.corp.com -via [email protected]

and you'll either get a) the SSH password prompt or b) direct login via keys, and once you've authenticated your SSH session, you should see the vncviewer password window as if you were on the local network.

For a good GUI application, look at Remmina:

http://remmina.sourceforge.net/

Remmia allows you to set-up a connection that uses an SSH tunnel through a bastion host. I have used it in the past to do exactly what you're attempting.