home » ltsp » install x11vnc on ltsp5
This is how I installed x11vnc on our Debian Lenny LTSP5 server, these are my notes, nothing more. Use at your peril.
Enter the chroot
$ sudo chroot /opt/ltsp/i386
And update the repositories that the ltsp environment uses for apt-get:
# apt-get update # apt-get install x11vnc
Still in the chroot, edit /etc/init.d/x11vnc and copy in the following script:
#!/bin/sh ### BEGIN INIT INFO # Provides:x11vnc # Required-Start:$remote_fs $syslog # Required-Stop:$remote_fs $syslog # Default-Start:2 3 4 5 # Default-Stop:0 1 6 # Short-Description:Start X11VNC # Description:Start VNC server X11VNC at boot ### END INIT INFO case "$1" in start) sleep 6 XAUTH=`find /var/run/ldm-xauth* -type f` logger -f /var/log/x11vnc "Starting with $XAUTH" start-stop-daemon --start --oknodo --pidfile /var/run/x11vnc.pid --background --nicelevel 15 --make-pidfile --exec /usr/bin/x11vnc -- -display :7 -loop -passwdfile /etc/x11vncpassword -nossl -logfile /var/log/x11vnc -auth $XAUTH ;; stop) logger -f /var/log/x11vnc "Stopping" start-stop-daemon --stop --oknodo --pidfile /var/run/x11vnc.pid ;; restart) logger -f /var/log/x11vnc "Restarting" $0 stop $0 start ;; condrestart) PID=`cat /var/run/x11vnc.pid` RUNNING=`ps h --ppid $PID` if [ "$RUNNING" == "" ]; then logger -f /var/log/x11vnc "No process matching /var/run/x11vnc.pid" echo "No process matching /var/run/x11vnc.pid" $0 restart else logger -f /var/log/x11vnc "Process matching /var/run/x11vnc.pid exists" echo "Process matching /var/run/x11vnc.pid exists - no action taken" fi ;; *) echo "Usage: $0 start|stop|restart|condrestart" exit 1 ;; esac exit 0
Still in the chroot, make the script executable and link it into /etc/rc2.d:
# chmod 755 /etc/init.d/x11vnc # update-rc.d x11vnc defaults # ls -al /etc/rc2.d/*x11vnc
Finally, create the /etc/x11vncpassword file with the password you want to use to connect to your thin clients:
# echo "thepassword" > /etc/x11vncpassword # chmod 400 /etc/x11vncpassword # chown root:root /etc/x11vncpassword
Replace "thepassword" with your chosen password.
The issue with the above method is that if you user does not reboot their client after logging off, then x11vnc does not restart. An alternative, remove the above symlink from /etc/rc2.d/S99x11vnc and instead use an ldm start up script by adding the following two scripts:
# /opt/ltsp/i386/usr/share/ldm/rc.d/I99-x11vnc # LDM Script to start x11vnc XAUTH=`find /var/run/ldm-xauth* -type f` start-stop-daemon --start --oknodo --pidfile /var/run/x11vnc.pid --background --nicelevel 15 --make-pidfile --exec /usr/bin/x11vnc -- -display :7 -loop -passwdfile /etc/x11vncpassword -nossl -logfile /var/log/x11vnc -auth $XAUTH
The "I" in I99-x11vnc denotes that this will be run after X and before LDM, which is perfect for VNC.
# /opt/ltsp/i386/usr/share/ldm/rc.d/X99-x11vnc # LDM Script to stop x11vnc start-stop-daemon --stop --oknodo --pidfile /var/run/x11vnc.pid
The "X" denotes that this script will be run upon logout, so this is closing down the x11vnc server, ready to restart with LDM.
This method will still not cope with X being terminated with ctrl+alt+backspace, in which scenario you can ssh onto the client and run "/etc/init.d/x11vnc condrestart" - you could also add this in as a local app to be accessible from the server desktop.
Thanks, this post saved me a lot of time
Since I'm coming here five years later, I found a few minor gotchas:
I've noticed ldm creates a new /var/run/ldm-xauth dir on each logoff/login. I don't think find alone can cope with that. I ended up with this in my script: XAUTHls -t /var/run/ldm-xauth/head -1
I also had to move the I script to an X script, and the X script to a K script. Otherwise I got two x11vnc instances on first login and none on logoff/login.
For anyone curious on what each letter means, it's available in /usr/share/ldm/ldm-script