x11 logo

x11 logo

Persistent Server VNC

I have a home server I call a NAS but it also does some other stuff. Occasionally I find the need to do some GUI things, and I don’t want to be bothered with a physical keyboard and mouse as that’s quite inconvenient due to the physical setup. I require use of the real graphics card for this, so, using virtual desktops is not an option, so to that end I will use x11vnc since it shares existing X displays.

I suppose there is a more elegant solution to this problem but this is fine for me. I am running Debian 10, with the LXDE desktop environment. Bog standard Debian desktop install.

I’m going to make lightdm log me in my non-root user automatically:

[email protected]:~# nano /etc/lightdm/lightdm.conf

Add your user under Seat:*

autologin-user= MadRush

~/.xsessionrc runs stuff as soon as you are logged in to X. It’s a perfect spot to make x11vnc start up:

[email protected]:~$ cat .xsessionrc 
/usr/bin/x11vnc -forever -display :0 -auth guess -rfbauth /home/MadRush/.vnc/passwd & disown

Okay so next time you log in, x11vnc will be started. And -forever means it will stay open after you disconnect. Going forward lightdm will automatically log you in, et voila, there’s your persistent x11vnc session. Restart lightdm:

[email protected]:~# systemctl restart lightdm

Good to go! Now I can log in at the physical console if I want, and then pick up where I left off should I want to use VNC instead.