howto vnc server

  1. Enable XDMCP

System->Administration->Login Screen Setup
Tab Security->Enable XDMCP

  1. Install required packages (vncserver and xinetd)

sudo apt-get install vnc4server xinetd

  1. Set the VNC passwd

sudo vncpasswd /root/.vncpasswd

  1. Add vnc service to xinetd:

sudo gedit /etc/xinetd.d/Xvnc

Enter this into the new file:

service Xvnc1
{
type = UNLISTED
disable = no
socket_type = stream
protocol = tcp
wait = yes
user = root
server = /usr/bin/Xvnc
server_args = -inetd :1 -query localhost -geometry 1024x768 -depth 16 -once -fp /usr/share/X11/fonts/misc passwordFile=/root/.vncpasswd
port = 5901
}

For more than one vnc session, duplicate the code above incrementing the screen number and the port as in the code below

service Xvnc1
{
type = UNLISTED
disable = no
socket_type = stream
protocol = tcp
wait = yes
user = root
server = /usr/bin/Xvnc
server_args = -inetd :1 -query localhost -geometry 1024x768 -depth 16 -once -fp /usr/share/X11/fonts/misc passwordFile=/root/.vncpasswd
port = 5901
}

service Xvnc2
{
type = UNLISTED
disable = no
socket_type = stream
protocol = tcp
wait = yes
user = root
server = /usr/bin/Xvnc
server_args = -inetd :2 -query localhost -geometry 1024x768 -depth 16 -once -fp /usr/share/X11/fonts/misc passwordFile=/root/.vncpasswd
port = 5902
}

service Xvncn
{
type = UNLISTED
disable = no
socket_type = stream
protocol = tcp
wait = yes
user = root
server = /usr/bin/Xvnc
server_args = -inetd :n -query localhost -geometry 1024x768 -depth 16 -once -fp /usr/share/X11/fonts/misc passwordFile=/root/.vncpasswd
port = 590n
}

  1. Restart xinetd (usually there is no need to reboot, but occasionally it might be required)

sudo /etc/init.d/xinetd stop
sudo killall Xvnc
sudo /etc/init.d/xinetd start

  1. That’s it! To test that this is working first try to connect from the same machine (the machine we just set up the VNC server on):

vncviewer localhost:1

comments powered by Disqus