VNC (Virtual Network Computing)

0. What is it?

In computing, Virtual Network Computing (VNC) is a graphical desktop sharing system that uses the RFB protocol (remote framebuffer) to remotely control another computer.
It transmits the keyboard and mouse events from one computer to another, relaying the graphical screen updates back in the other direction, over a network.
Here we describe how to install and configure Tightvnc and Vino, but there are several other alternatives. In a gnome desktop I prefer Vino much better than Tightvnc.

1.Installing and configuring the server Tightvncserver in Debian Squeeze

We use TightVNC because it is free open source software (GPL2), provides compression to allow it to work over a slow network (Internet) and is readily available in the software repositories.

VNC follows the traditional client-server model.
The server software runs on the host to be accessed, and client software runs on the local machine that wishes to control the host.
The server and client do not have to be the same (eg. the client can be RealVNC when the server is TightVNC), but some features may only work when the same client and server are used.

First refresh the software repository information using

sudo apt-get update
sudo apt-get upgrade

Install the server software from the repositories:

sudo apt-get install tightvncserver

Now we start the server and assign a number to the connection client-server (in this case number 1).
We may define as many connections as we need:

tightvncserver :1 -geometry 1680x1050 - dpi 96

The option -geometry defines the size of the window to be open by the client. You can use a different one for each connection that you define. This way you may work with different clients working with different screens with no trouble at all. If the clients work in full screen mode it is good to choose the size of the client's screen.

The option -dpi (it is not defined in the man page!) defines the resolution of the screen.
This option is important if you want to have the same font size for both vncviewer and the client desktop.
To find out which resolution you need, in the client's system type:

xdpyinfo | grep -i "dots per inch"

and you will get the resolution of the client's screen. Use this number for -dpi option. Default value is 75.

Tightvncserver uses port 5900 + the number of the connection.
This means that if you define connection :1, you need to open (or forward) port 5901 in your firewall (or router).

2. Install and configure vino in a gnome desktop

Another, even better vnc server is Vino, which is already installed in a Gnome desktop.
Actually it is integrated in Gnome and it allows you to completly shear the desktop, so you only have to configure it.
Go to System -> Preferences -> Remote desktop and click in the first option which allows you to shear the desktop.
It is also good to enter a password for security reasons.

The default port is 5900 so you have to access the server from the client with IP:0 (see below).
If you wish to change the default port, enter in a terminal the following command:


and go to Desktop -> Gnome -> Remote access, then change the alternative port and click on use_alternative port.
After that check on Remote Desktop to make sure you are still sharing the desktop with a password.

It can be necessary to run vino when gdm is loaded, so we can have access to the display manager and we can login from our VNC client.
To achieve this, we run vino-preferences as root:

sudo vino-preferences

Check "Allow other users to view your desktop" and "Allow other users to control your desktop" and uncheck "Ask you for confirmation".
I do not recomend assigning a password at first (you can do that later when everything runs fine).

Next we go to System --> Preferences --> Startup applications and disable "Remote Desktop: Gnome Remote Desktop Server".

Finally, edit /etc/gdm/Init/Default

sudo gedit /etc/gdm/Init/Default

Add the following line just before "exit 0" at the end of the file:

/usr/lib/vino/vino-server &

This way vino starts running together with gdm3 (at Login Screen).

3. Installing and configuring the client (Xtightvncviewer)

In the client's computer, we install the viewer with:

sudo apt-get install xtightvncviewer

To avoid problems with the keyboard in full screen mode (who owns the keyboard, the client's desktop or vncviewer?) we shall give the keyboard to vncviewer.
To do that we just type:

echo "Vncviewer*grabKeyboard: true" >> ~/.Xresources
xrdb -merge ~/.Xresources

in order to define the option grabKeyboard in the /home/user/.Xresources file.

We are ready to login using

xtightvncviewer -fullscreen -x11cursor

(replace with your own server's IP address as appropriate).

Do not use the option -fullscreen the first time, just in case you can't get out... use F8 to scape from fullscreen mode.
if F8 does not work, it is imperative to use the grabKeyboard option as explained at the begining of this section.
The option -x11cursor shows a more beautiful pointer for the mouse.

Raconet Linux