How To Access A VNC Remote Desktop After The Server RebootsFiled on Mar 2, 2009 by AnthonyDiSante
Ubuntu Linux, and probably other modern versions of Linux, include a built-in VNC server for remote desktop access. In Ubuntu this is called vino-server and it’s enabled via Main Menu -> System -> Preferences -> Remote Desktop.
But since this runs as the user who’s logged in to Gnome, it only starts after that user is logged in. So if you’re away from the PC and accessing it remotely, but something happens which causes/requires it to reboot, then when it comes back up, you won’t be able to access the VNC server because the user won’t be logged in.
The solution to this is actually simple as long as you have SSH enabled and you have root access (via "sudo su" for example) to the server. Just SSH to it using your normal user account. Then edit the /etc/gdm/gdm.conf file (actually it’s /etc/gdm/gdm.conf-custom on Ubuntu) and add the following lines to the [daemon] section:
Then either reboot the server by running "sudo shutdown -r now", or just restart gdm by running "sudo killall -HUP gdm". Once gdm restarts, it will automatically login as the specified user, and your vino-server process will then start, so you can VNC into the system again. Don’t forget to remove those auto-login lines from your gdm conf file when you’re done.
UPDATE: alternatively you could forget about vino and the Remote Desktop preferences altogether, and just install x11vnc on the remote system. Once it’s installed you just run it from your SSH shell, passing "-rfbauth NNN" where NNN is the port number you want it to run on. Then run your VNC viewer app on your local system to connect to the remote system on that port.