Continuously: Have x11vnc reattach each time the X server is restarted (i.e. after each logout):
To make x11vnc always attached to the X server including the login screen you will need to add a command to a display manager startup script.
Please consider the security implications of this! Besides having the VNC display for the X session always accessible (but hopefully password protected), there may other issues.
The name of the display manager startup script file depends on desktop used and seem to be:
GNOME /etc/X11/gdm/Init/Default (or Init/:0)
KDE /etc/kde*/kdm/Xsetup
XDM /etc/X11/xdm/Xsetup (or xdm/Xsetup_0)
CDE /etc/dt/config/Xsetup
although the exact location can depend on operating system and distribution. See the documentation for your display manager: gdm(1), kdm(1), xdm(1), dtlogin(1) for additional details. There may also be display number specific scripts: e.g. Xsetup_0 vs. Xsetup, you need to watch out for.
Note: The above gdm setting of KillInitClients=false in /etc/X11/gdm/gdm.conf (or /etc/gdm/gdm.conf, etc.) for GDM is needed here as well. Other display managers (KDM, etc) may also have a similar problem.
Note: The above Dtlogin*grabServer:False step for Solaris will be needed for dtlogin here as well.
In any event, the line you will add to the display manager script (Xsetup or whatever) will look something like:
/usr/local/bin/x11vnc -rfbauth /path/to/the/vnc/passwd -o /var/log/x11vnc.log -forever -bg
where you should customize the exact command to your needs.
Happy, happy, joy, joy: Note that we do not need to specify -display or -auth because happily they are already set for us in the DISPLAY and XAUTHORITY environment variables for the Xsetup script!!!
You may also want to force the VNC port with something like "-rfbport 5900" (or -N) to avoid autoselecting one if 5900 is already taken.
Bookmarks