Start VNC together with LightDM

If you want to start a VNC server before login on your Linux machine a good option is to make the graphical login manager start the VNC server, in my case LightDM.

This solution will restart the VNC server if you logout since the VNC server will exit on logout.

Add the following to /etc/lightdm/lightdm.conf

display-setup-script = /etc/lightdm/

And create the file /etc/lightdm/ and add the line to start your VNC server in that file

/usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc/passwd \
-forever -bg -gone "xscreensaver-command -lock" -nodpms -rfbport 5900 -httpdir /usr/share/vnc-java/ -httpport 5800 \
-rfbversion 3.6 -permitfiletransfer -shared -dontdisconnect -alwaysshared -o /var/log/x11vnc.log &

Make the script executable

sudo chmod u+x

Restart Lightdm

service lightdm restart

Start VNC together with LightDM | Roger Steneteg.


Bad Behavior has blocked 95 access attempts in the last 7 days.