*Update.  You can do the following or you can make life easy and use www.teamviewer.com

 

This is really for me to remember…..
We all know how to do local tunnels with SSH but this is how to a remote tunnel to get around 2 firewalls.

Example….. A user on their mac, pc, whatever is behind their DSL router has SSH and Remote Desktop/VNC available.
You are at work or at your home behind a firewall.
You have access to an intermediary SSH server available on the Internet for both parties to connect to.

So, for example, a mac user would enable Remote desktop under Sharing and then open Terminal and type:

# ssh -R 57000:localhost:5900 user@sshserver.somewhere.com

This breaks down thus:

-R means create a remote tunnel with a port listening on the remote SSH server
57000 is the random port I chose (over 1024) to use on the remote server. For this to work you have to add “GatewayPorts yes” to your sshd_config.
localhost:5900 = the local port you want the remote user to connect on (VNC)

Once that connection is made, on the other end of the connection, let’s say its a Windows box (with cygwin for ssh or Putty) you would run:

ssh -L 57000:localhost:57000 user@sshserver.somewhere.com

This breaks down thus:

-L 57000:localhost:57000 means create a local tunnel from the remote port 57000 to local port 57000.

Once this is connected, on the Windows box, open vncviewer and connect to localhost:57000 and you will connect to the Mac.

Voila

Tags: , , , , , ,