The reason I use x11vnc is that it connects to the existing graphical session. Most other vnc servers will spawn an entirely new graphical session. While that is super cool, I don’t want that feature. This is for remote support, where I want the user and the supporter to share the same session. I use the ‘-auth guess’ to have x11vnc guess the XAUTHORITY file‐name and use it appropriately. This avoids the annoying hard coding of gdm, lightdm, xdm or specific users .Xauthority.
apt-get install x11vnc
The following should work for any distro that uses systemd, just the apt bits are Debian specific.
Generate the password and store it under etc so no users can change this password, only root. You can do this under your users home so that its not managed by root. In my case I didn’t want the user to be able to change or accidentally delete the password.
sudo x11vnc -storepasswd /etc/x11vnc.pwd
edit (create new) the following file
use whatever text editor you prefer, here I use vi
sudo nano /etc/systemd/system/x11vnc.service
And add the following, making any changes you want to the x11vnc ExecStart
See the man page for explanations of the switches
[Unit] Description=Start x11vnc at startup. After=multi-user.target [Service] Type=simple ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pwd -rfbport 5900 -shared -o /var/log/x11vnc.log [Install] WantedBy=multi-user.target
Now enable the above, start it and verify its running and listening properly
systemctl enable x11vnc
systemctl start x11vnc
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 2806/x11vnc
Now that the server is all setup lets move onto the client
apt-get install tigervnc-viewer
vncviewer [remote host ip or hostname]