SSH with port forwarding for VNC sessions

The problem:

               |
Client   ------|--- SSH server -----  VNC server
               |
            firewall

(Of course this doesn't really have to be VNC - it could be any application such as web, mail etc.).

We'd like to access the VNC server by establishing a tunnel via the SSH server.

(Note, the way VNC handles display numbers is that it constructs ports as offsets from the base port number of 5901. Thus VNC display :6 is mapped to port 5906.)

Let 10.10.10.10 be the ip address of the VNC server.
Let 10.10.10.20 be the ip address of the SSH server.


  1. Connect to the SSH server which in turn connects to the VNC server. Here we are making VNC server port 5906 (display :6 in VNC terms) available locally as port 9999.
            ssh -L   9999:10.10.10.10:5906  username@10.10.10.20

          When asked you supply the password to the SSH server.

     2. Use the VNC client program to connect to the localport - in this case 9999. Do this from another xterm or console. Here the VNC password needs to be supplied, either interactively or by other means.

               vncviewer  localhost:9999


In the language of port fowarding we have "forwarded" port 5906 from the VNC server (10.10.10.20) to our local client machine's port 9999 where it can be accessed as localhost:9999.

Comments

Popular posts from this blog

Hit failing alternator with a hammer to confirm diagnosis of failing alternator due to bad brushes

alternatives --install gets stuck: failed to read link: No such file or directory

Using SSH, SOCKS, tsocks, and proxy settings to create a simultaneous "dual use" work/home computer