VNC over SSH, the idiots guide.

Since I rather like to have options, I’ve decided to augment my usual SSH /w option of X forwarding to the option of VNC as well.

Objective: connect to my netbooks X session using VNC, tunnelled over SSH.


Since my netbook runs a GNOME centric distribution, I’m using the “Remote Desktop” preferences program on “System -> Preferences”. If you’re like me and to damn lazy to hunt and peck, this just runs the program ‘vino-preferences’. On here it’s possible to setup VNC access to your desktop. In essence, it just runs vino when you login. There are loads of good and bad write ups on VNC server setup and 3 or 4 click setup is good enough for me.

My iptables rules pretty much block such things as incoming VNC requests, which is good because I don’t want the session exposed across the network interface. Pretty much all there is for accessing my netbook is the SSH port.

Now on another system, it’s possible to connect using SSH forwarding. This gains us both encryption for the VNC session and less port exposure; that is good for security.

PuTTY client setup:

  1. Load/create your session in PuTTY
  2. Go to SSH -> Tunnels
  3. Add a port forwards
    1. source port: 5900
    2. destination: localhost:5900
  4. Login to the system using PuTTY.
OpenSSH client setup:
  1. ssh -L 5900:localhost:5900 username@host
There are options for both if disabling the shell session and only running the forwarding is preferred (PuTTY: SSH->Don’t start a command at all; OpenSSH -> RTFM for -n, -N, and -f). 5900 is the default VNC port running off the server end (my netbook).
Now on the client machine, connecting any VNC client (e.g. TightVNC) to localhost should give the desktop session over at user@host; in this case, my X session on alice!
This is the shortest, sweetest, non-non-sense, you’re assumed to know how to RTFM if you want to know the facts, kind of write up that I’ve seen on doing this. Hmm, maybe it helps that I already know how to use SSH port forwarding with OpenSSH, hehehe.

1 thought on “VNC over SSH, the idiots guide.”

  1. I know this is the most inappropriate place to post this but I am short on time.

    Happy birthday for three days ago!
    Hope you had a great time.

    Almost finished with exams, hope to catch up soon.

Comments are closed.