Home » Odeon Blogs » Stefan Talpalaru, CTO »

x11vnc init script

x11vnc init script

If you need remote access to a X server running on a Linux box (the real display, not a Xvfb session) your best bet is x11vnc. It has all the fancy compression protocols and SSL/TLS encryption along with a bunch of authentication schemes. The only thing that's missing is an init script so it can be run as a persistent service. Here's the one I'm using on Gentoo - /etc/init.d/x11vnc:

  1. #!/sbin/runscript
  2. depend() {
  3. need xdm
  4. after xdm
  5. }
  6. start() {
  7. ebegin "Starting x11vnc"
  8. start-stop-daemon --start --quiet --pidfile /var/run/x11vnc.pid --make-pidfile --background --exec x11vnc -- -auth guess -display :0 -forever -ssl SAVE -http -unixpw_nis -o /var/log/x11vnc.log -loop
  9. eend $?
  10. }
  11. stop() {
  12. ebegin "Stoping x11vnc"
  13. start-stop-daemon --stop --quiet --pidfile /var/run/x11vnc.pid
  14. eend $?
  15. }

You'll want to run the x11vnc command manually the first time (as root) to create the SSL certificate and to debug any problem that might appear. Once it's all good, feel free to "/etc/init.d/x11vnc start; rc-update add x11vnc default". It will be started after xdm, so there's a X server to connect to. Because of the '-loop' option it will restart 2 seconds after being closed so you can log off from your session, thus restarting X and giving back control to the display manager, wait a few seconds then connect again over VNC and login. The automation is especially useful if the user can't be bothered to login over ssh and run a command each time he wants access. In fact, things can be simplified even further by using the java applet as a viewer - just point the user to http://yourhost:5800/ and all he needs is a java enabled browser. The applet uses SSL so it's secure, and the authentication is done with the existing Unix accounts (disregard the 'nis' in '-unixpw_nis', it's just a 'crypt' based method for checking passwords)


Categories: Gentoo Linux



Leave a Comment :

(required)


(required)




(required)




(required)






Leave a Comment


Page generated in: 0.15s