Tunneling VNC over SSH

There have been many times, while I was at work, when I wanted to access my computer at home. There are many different ways to do this. GoToMyPC LogMeIn and Hamachi are some online services that you can use to access your pc. I’ve tried all of these (I haven’t used Hamachi much, but it looks pretty neat from what I can tell), and while they work fine the free components don’t have all the features I want. Specifically file transfer. So I decided to setup Vnc for remote access and tunnel it through SSH for additional security.

You could just setup Vnc and use that by itself for remote access. But vnc is not encrypted, so it send everything you do across the internet, including your password in plain text. While the odds of getting your password sniffed out by a hacker are probably slim, you don’t want to take that chance. So SSH tunneling is neccessary.

SSH tunneling involves establishing an ssh connection, and forwarding the port you need over this connection. This allows SSH to encrypt all the info you send. It does add some overhead, but the securiy and privacy is worth it. This guide focuses on Windows. If you use another os you probably already know how to do all this.

On the remote computer

1. Setup an SSH Server on your remote pc
I chose freeSSHd, which an easy to setup free ssh server for windows. Download and install the ssh server.

2. Configure the SSH Server
Click the freeSSHd tray icon. Select the users tab, and click add to create a user.

Create User

To use the existing nt authentication settings for this user name, select that option. Make sure to check the tunneling tab. You can also select sftp and shell too to allow the user these functions. Then select apply.

Next select the tunneling section on the list on the left.

Tunneling Screen

Check allow local port forwarding. Then check apply and hide to hide the options. You may need to go into your router or firewall and open up port 22 which is the default ssh port.

3. Install and configure UltraVnc
There are many versions of VNC, but my favorite is UltraVnc. It has many useful features like file transfer, local chat, enhanced display driver, and encryption. (I haven’t tried out the encryption, but it if it is good, it could make ssh unneccessary). Install the server as a service.

UltraVNC Options

In the options screen be sure to set a password. Be sure to check allow loopback connections. This can cause problems with vnc, but to do ssh tunneling it is neccessary.

On your local computer

1. Configure Putty
To access your remote computer you need Putty, a small app that you can use to make SSH connections. Download it then run putty.exe. Enter the name or ip address of your remote computer. If you have a dynamic IP address then it may be helpful if you get a DynDns account. This free account will allow to assign a hostname to your ip address. Install the autoupdate utility to have your account updated everytime your ip changes. Then select the tunnels option in the ssh menu on the left.

Putty Tunnels

Enter 5900 as in the source field, and localhost:5900 in the destination field. Click save. It will definitly save you time if you give a name and save this info as a profile in the main page.

2. Log in to your remote system
Install the UltraVNC viewer which is the same install file as the server. Then open up Putty and connect to the profile you saved. Accept the key if a dialog comes up. Then log in with the same username that you setup earlier. Next open the vnc viewer and connect to localhost. If everything is configured properly you should be able to log in and view your desktop of the remote pc. You can also be confident that your session is encrypted and completely private and secure.

If you have any questions about this process feel free to email me and I will try to help you out.

1 Response to “Tunneling VNC over SSH”


  1. 1 Mike Krizmanic

    Great Article.

    It worked exactly as outlined with none of that Linux emulation nonsense in just about every other VNC/SSH article for Windows. The encryption was even confirmed with protocol analysis.

    5/5 Stars!

Leave a Reply