A few days ago, while waiting for code to compile, I logged in to my computer from work, and performed a long overdue package upgrade, which required a reboot to complete. This left me logged out of the desktop, with the GDM3 greeter waiting for someone to log in, but no VNC server to allow remote access to it.
Here's how to run a VNC server and start the desktop, in this situation:
- connect to the remote machine with
ssh, forwarding the default VNC port (this is the usual way I access my home PC):
# ssh -L 5901:localhost:5900 example.home-computer.com
- run the following command as
rootto detect the path to the X authority file:
$ ps ax | grep auth 1398 tty7 Ss+ 4:30 /usr/bin/Xorg :0 -br -verbose -novtswitch -auth /var/run/gdm3/auth-for-Debian-gdm-e7ERxa/database -nolisten tcp vt7 5053 pts/5 S+ 0:00 grep --color=auto auth
- launch a VNC server (as
root) that allows access to your real X11 display, using the path to the X authority file (I use
$ x11vnc -xkb -ncache 0 --forever -localhost -display :0 -auth /var/run/gdm3/auth-for-Debian-gdm-e7ERxa/database
- back on the local machine - connect to the remote machine with a VNC viewer (I use
# vncviewer -FullScreen -LowColourLevel 2 -PreferredEncoding ZRLE localhost:1you should now see the remote GDM greeter and be able to login to your desktop.