An Open Access Peon

20 May 2010

Ubuntu 10.04 vnc-based login server

This recipe is for setting up a VNC login server. This allows you to use a VNC client to access a full GUI on a remote server. If instead you want to get VNC access to your desktop (or share with other users) you need to enable remote desktop.

VNC connections are not encrypted so if you connect directly to the VNC server any login details will be sent in the clear.

Install the required packages:

sudo apt-get install vnc4server xinetd gdm


Restrict GDM to only listening to localhost by adding the following to /etc/hosts.allow:

gdm: ip6-localhost


Enable XDMCP in GDM by setting up /etc/gdm/custom.conf as:

# GDM configuration storage

[daemon]

[security]

[xdmcp]
Enable=true
HonorIndirect=false
# following line fixes a problem with login/logout
DisplaysPerHost=2

[greeter]

[chooser]

[debug]


Create a new xinetd service /etc/xinetd.d/Xvnc (adjust geometry to get different screen sizes):

service Xvnc
{
type = UNLISTED
disable = no
socket_type = stream
protocol = tcp
wait = no
user = nobody
server = /usr/bin/Xvnc
server_args = -inetd -query ip6-localhost -geometry 1280x800 -depth 16 -cc 3 -once -SecurityTypes=none
port = 5901
}


Restart gdm (which will close any current logins!) and xinetd:

sudo service gdm restart
sudo /etc/init.d/xinetd restart


You can then connect to the VNC server using:

vncviewer localhost:5901