VNC Tunnel Windows

SSH Tunneling Using PuTTY on Windows

The PuTTY SSH client can tunnel ports on a remote machine through an SSH connection. What is SSH tunneling? Let's say there is a program (e.g., mail) that is listening for a connection on a certain port of a remote machine. The connection may not be secure. With SSH tunneling, you instead make the connection to an arbitrary port on your local machine. Your SSH client (which has been set up ahead of time) intercepts all traffic to that local port, sends it securely over the Internet via SSH, and causes it to appear at the designated port on the remote machine.

SSH connection

This can be done with any program that communicates over the Internet, such as vncserver, etc.

How to Start a PuTTY Session with SSH Tunneling

Open PuTTY. In the Session pane that appears, enter the name of the remote machine. Don't change the default port number in this pane.

Next, navigate the menu on the left until you see SSH and, beneath that, a Tunnels option. In this example, a VNC server is listening on the remote port 5901, and we are attempting to tunnel it to local port 10000.

PuTTY Connection

After filling in the port numbers and "localhost" as shown, it is critical to click the Add button, or the tunnel will not work. After clicking the Add button, the pane should look like this:

PuTTY Connection Port

Now open the SSH connection. You will possibly need to enter your username and password on the remote machine. Leave this session running in the background; minimize it if you like.

If the connection does not work, open the PuTTY menu from the top bar of your terminal window:

PuTTY Connection from Terminal

Choose Event log. If the end of the event log lists failed attempts to start the tunnel, then it didn't work. Continue with directions below to try again.

How to Start an SSH Tunnel Within a PuTTY Session

Open the PuTTY menu on the terminal window as shown in the picture above, and choose Change Settings.... On the left, find in the menu the choice for SSH and Tunnels. You should see a place to enter information about the desired tunnel.

Start an SSH Tunnel

Be sure to click Add once the information is entered, or the tunnel won't happen. Then click Apply at the bottom.