How to Tunnel VNC Connection through SSH Using PuTTY

VNC is a protocol that allows a desktop to be viewed and controlled remotely over the Internet.

This is how to create VNC tunnel via SSH.


  • Ubuntu system (as VNC Server)
  • Windows system (as VNC Viewer)
  • PuTTY for Windows
  • TightVNC Viewer or RealVNC for Windows

In Ubuntu PC, install x11vnc and openssh-server:

$ sudo apt-get install x11vnc openssh-server

Make sure your firewall allowed incoming connection on port 22.

In Windows PC, download and install: PuTTY, TightVNC / RealVNC.

Run PuTTY and go to PuTTY configuration window: Connection > SSH > Tunnels.

In Tunnels section of PuTTy, type 5902 for Source port, and type localhost:5900 for Destination, then click Add.

Go back to Session section of PuTTY, type Ubuntu IP Address for Host Name (or IP address) , and type 22 for Port, then click Open.

Type in Ubuntu login name and password in PuTTY window, and then type the following line in Ubuntu shell:

$ x11vnc -safer -localhost -nopw -once -display :0

Make sure there is no error message when you run the above command.

Now leave the PuTTY window, then run TightVNC / RealVNC Viewer.

Type localhost::5902 for VNC server and press Connect.

Finish. Now you can access Ubuntu PC remotely via SSH.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.