Add Me!Close Menu Navigation

My technical corner about Linux, Perl, programming, computer networks and network security

Add Me!Open Categories Menu

Remote technical support by VNC through SSH Tunnel

I suppose that you are an advanced linux user. And those skills make you really happy. But, sometimes we have a big problem: our friends may want to have Linux on their computers. There are many reasons why. Probably Linux looks like pretty for those people. The main point is: they are (usually) novice users. They will need your help in the future probably. Your friends – your problems. No mercy. ;-)

But I have found small solution for this problem. The solution. is of course, a SSH tunel for VNC protocol. The computer of your friend establishes automatically connection to your machine and creates a tunnel for you. This conception works over NAT networks (either you and your friend network).

You need the following things:

  • Linux on computers (your and your friend) – of course on Windows this is also possible, but my script works on the Linux-based systems
  • the AutoSSH and on the client computer (your friend)
  • the OpenSSH on the client (if you want to establish a ssh connection) and on the server computer (yours)
  • Public key based authentication – on the server computer, for security reasons you need to create a new user on your server computer
  • x11vnc server on the client computer – for security reasons it should listen only on the loopback interface (mostly
  • and of course – a vnc client on the server computer for connect to the the client (krdc, vncviewer, vinagre, etc)

The script contains:

  • – to establish the tunnel for ordinary ssh connection for emergency (optional component)
  • – to establish the tunnel for the VNC connections
  • – to run the vnc service (if it doesn’t work)
  • – main script which launches the others. It’s runs by the crontab.

How it works:

  1. The on the client computer script runs the other scripts (, and if you want too). This script should be add to the crontab.
  2. The scripts and establish connection to the server computer and create the tunnels for the VNC service and the SSH service
  3. The script on the client machine checks whether the VNC service is works and lauchnes it, if not.
  4. The server computer has the OpenSSH service which allows the public key based authentication (the key without password is need for and

You have to read the comments in the scripts to configuration before use it!

DOWNLOAD: The VNC throught ssh tunnel script

Leave a Reply

You must be logged in to post a comment.