Install X11vnc server

This version of the VNC server allows to remote control the real display, e.g. display :0

Upgrade to KDE 3.5.6

In my installation of Edgy, KDE 3.5.5 crashed when invoking x11vnc. I solved it by adding the KDE 3.5.6 repository sources.list:

deb http://kubuntu.org/packages/kde-356 edgy main
apt-get update

Install x11vnc

apt-get install x11vnc

Settings

Create the file /home/username/.x11vncrc with the following content:

#x11vnc command line options
# display :0
rfbport 20000
usepw
scale 3/4
scale_cursor 1
forever
loop
bg

Create /home/username/.kde/Autostart/startX11vnc:

#!/bin/sh
killall x11vnc &>/dev/null
sleep 10
x11vnc

Make sure it has the correct ownership and permissions:

chown username:username startX11vnc
chmod 750 startX11vnc

Start x11vnc manually the first time to allow for setting up the vnc server password. Afterwards, x11vnc will start on default when kde is starting up.

cd /home/username/.kde/Autostart/startX11vnc
./startX11vnc

When I tried vncserver and x11vnc, I managed to block my desired listening port for x11vnc, apparently owned by kdeinit. To resolve this, delete the .kde directory within your home directory, this resets all KDE settings and also releases the port(s).