How to get a VNC with resume support through XDMCP in Ubuntu.

Apr 24, 2007 09:09 GMT  ·  By

Have you ever needed to access some documents stored on your home desktop while at work? Do you want to use that powerful server on your LAN for running heavy applications that your low-end PC doesn't support? How about a persistent VNC connection to a Linux desktop environment; have you ever needed that? These examples can go on forever since a VNC connection may be used for a lot of purposes. Unfortunately, the basic VNC system only duplicates the current screen on a remote system and terminates the desktop session when the connection is terminated. Imagine how you would feel if you were running an important application on a remote machine through VNC and the connection failed: on the next reconnect, you'll find that application crashed.

This is when XDMCP comes into play: unlike basic VNC sessions, XDMCP allows several users to login and run persistent Gnome sessions at the same time. This means that even if you disconnect the VNC client, your Gnome session won't end unless you explicitly log out, allowing you to resume it at any time. Sounds good? It's also easy to set-up:

ENABLE XDMCP

In your regular Gnome session, click on System, choose Administration and open the Login Window.

screenshot

Click on the Remote tab and choose 'Same as Local' as the default Style. Then click the 'Configure XDMCP' button.

screenshot

Here, uncheck the 'Honor indirect requrests' option.

screenshot

You will now need to open a terminal. Either press the 'Alt+F2' key combination and type gnome-terminal in the Run Application dialog followed by Enter, or go to Applications / Accessories and click Terminal.

screenshot

In the terminal, type the following command to open the /etc/X11/gdm/gdm.conf file in a text editor:

code
gksudo gedit /etc/X11/gdm/gdm.conf
Once the text editor has opened, use its Search function to find the XDMCP section and enable it by setting Enable=True
screenshot

Next, find the following text and uncomment (remove the first #) the RemoteGreet line so it looks like this:

code
# The greeter for xdmcp logins, usually you want a less graphically intensive
# greeter here so it's better to leave this with gdmlogin
RemoteGreeter=/usr/lib/gdm/gdmlogin

INSTALL THE PACKAGES NEEDED

Make sure your Ubuntu system has the Universe repository enabled, then type the following command in the terminal opened earlier:

code
sudo apt-get install vnc4server/edgy xinetd
This command will force the installation of an older version of 'vnc4server' since the latest one will cause problems with XDMCP.

Now set a password for the VNC by typing this in the terminal:

code
sudo vncpasswd /root/.vncpasswd
Add the VNC service to xinetd. Execute this command to open a text editor:
code
cd /etc/xinetd.d
sudo wget http://download2.softpedia.com:8081/linux/Xvnc
Optionally, you can customize the Xvnc settings (such as the resolution) by opening the downloaded file in a text editor:
code
gksudo gedit /etc/xinetd.d/Xvnc
Finally, reboot your PC. VERY IMPORTANT!

After reboot, test the installation by running this command in a terminal:

code
$ vncviewer :1
VNC viewer version 3.3.7 - built Jul 4 2006 10:04:48
VNC server supports protocol version 3.8 (viewer 3.3)
Password: ENTER HERE THE VNC PASSWORD SET EARLIER
You should see:
screenshot

CONNECTING

There are two methods of connecting to the machine running VNC. Either go to another computer on the network and select XDMCP login from the Options button at login screen, or log in normally: open a terminal and type:

code
vncviewer ip.address.of.machine.running.vnc:1