X11vnc is an easy way to remotely access your Linux desktop from another Windows (or Linux) computer. In this post I will explain how to use X11vnc to securely access your Linux computer from Windows. X11vnc is a VNC server. A VNC server sends images of an X display to a client whenever the display changes. The default VNC server for Linux is Xvnc, which creates a virtual X display that is not displayed on a monitor. X11vnc is different from Xvnc because it works with X displays that are used with a real monitor. This is useful because you can connect to your normal desktop and use any applications you have left open. X11vnc is also easier to set up than a VNC server that creates a virtual display. Because VNC is insecure, you should tunnel it through SSH as I will show you here.

The first step is installing X11vnc and a SSH server on the computer that you want to be able to connect to. This command will install both in Ubuntu or Debian. Of course if you already have an SSH server installed you don’t need to install it again, just leave off the last part of the command.

apt-get install x11vnc openssh-server

If you want to access your computer from outside your network you will need to forward port 22 to the computer running the SSH server. You can do this in your router’s setup. Before you expose the SSH server to the Internet, make sure your SSH password is unguessable. Forwarding a VNC port is not needed. Also, you will need to know your global IP address so you can connect to it. A service like No-IP can help you with this.

The easiest way to set up the tunneling for VNC on Windows is to use PuTTY. PuTTY is a graphical SSH client for Windows. You can either download the normal stand-alone version of PuTTY or download a portable version that does not write to the Windows registry. I would recommend the portable version if you want to use it from public computers. The last piece of software you need is a VNC client. There are many choices, but I would recommend the TightVNC client because of its simplicity (all you need to get is tightvnc-1.3.9_x86_viewer.zip). Once you have both PuTTY and TightVNC on the computer you want to connect from, you are ready to begin connecting. You may want to keep these two programs on a USB flash drive so you can easily run them from any computer. Start by running PuTTY.

PuTTY 1

PuTTY 2

Under “Host Name”, enter the IP address or host name of the computer you want to connect to and the port that the SSH server is on (22 by default). Then go to the “Connection>SSH>Tunnels” category. You need to create a tunnel from port 5900 to 127.0.0.1:5900. You can then save these settings back on the main screen so you don’t have to configure PuTTY every time. Click open and log in.

Once PuTTY is logged in you have a shell. Do not run these commands following as root or it will not work. Start X11vnc by running the command below. The first time it is run, X11vnc will ask for a password. Say yes to let it save to the default location. The server will then run.

x11vnc -usepw

TightVNC 1

Once the X11vnc server is running, start the TightVNC client. Connect to 127.0.0.1::5900. This address sends the VNC traffic through the encrypted tunnel. Enter the VNC password when prompted and you are done! TightVNC should display what is on the other computer’s monitor and you will have mouse and keyboard control. When you are finished, close TightVNC. The X11vnc server will automatically quit. Then you can exit PuTTY.

Good luck! If you can’t get it to work, leave a comment and I can try to help you out.


Related Posts