Connect to Linux Desktop from Windows
In previous post I wrote about how to secure communication between Linux and Windows machine with SSH. Now in this post I am going to show you how to control Linux (Ubuntu, Debian or any other distribution) Desktop from Windows over secure connection in a very simple and elegant way using just open source software. We are going to use VNC. VNC stands for Virtual Network Computing and it is a Graphical Desktop Sharing System that uses the Remote Frame Buffer Protocol (RFB) to remotely control another computer. It transfers the keyboard and mouse events from one computer to another and returns the graphical screen updates back to the client computer over a network. VNC is platform independent technology. There are clients and servers for different Operating Systems even including Java servers and clients. Multiple VNC clients may connect to a VNC server at the same time.
First let’s install VNC server. Obviously you need some Linux computer running a desktop software such as GNOME, KDE, XFC or any other. There are couple of VNC servers available for Linux, but we are going to use x11vnc. To install it just type:
Next step is to obtain software for Windows. You need PuTTY.
We are going to use PuTTY to secure communication between server (Linux) and client (Windows).
So download putty.exe
from this link
and place it in some directory. It does not need installation.
Next piece of software that we need is VNC client. There are couple of VNC clients. Most of them are commercial but free for non-commercial use. We are going to use TightVNC which is dual licensed. It has GNU GPL2 and commercial license. Also they have Java version. But in our case we are going to use native Windows binary. So go to download page and get 64 or 32 bit MSI installer package. During installation process select Custom Setup and install only VNC Client.
Next step is to run and connect to Linux via PuTTY. Follow those steps to perform secure connection to Linux.
- Start PuTTY.
- Go to Connection -> SSH -> Tunnels.
- In field Source port enter 5900.
- In field Destination enter localhost:5900.
- Click Add button.
At the end should look something like that:
Then navigate to PuTTY main window and enter IP or host to which you want to connect and hit Open button.
Login to Linux computer by using your name and password. Then type the following commands. Note that -auth output from first command is passed as parameter to the second one. You need to find the authentication file of your login manager. In this example I am using SLiM which stands for Simple Login Manager and it is really slim and light. But if you are using GDM or KDM then authentication file will be different. So see what is output after -auth and copy & paste it in the command that runs x11vnc.
For more info look into screenshot:
Finally you should see something like this:
Final step is to run TightVNC Viewer
and to connect. When you start TightVNC just enter
localhost in the field Remote Host and hit the Connect button.
If everything went normal you should see login screen of your Linux machine. Just type your user name and password to establish remote desktop session.