Thursday, October 20, 2011

Remote Desktop via VNC in Ubuntu 11.10

Mark outlined a few remote desktop methods here.  The method that has worked for me is to use x11vnc with a simple script to start it when I want to connect:
$ cat ~/bin/start-vnc.sh
#!/bin/sh
x11vnc -nopw -once -display :0 > ~/.vnc.log 2>&1 &
Then the sequence of events is to start a session is:
  1. Connect to my pc via ssh (and tunnel the vnc port 5900)
  2. Run start-vnc.sh
  3. Connect with vnc client (I use UltraVnc - it seems to work well)
The -once flag tells x11vnc to exit after you've disconnected.

If you need to connect before anyone is logged into the system, you'll need to use the -auth option to provide the correct authentication for the login screen.   In Ubuntu 11.10 this seems to work:

sudo x11vnc -nopw -once -display :0 -auth /var/run/lightdm/root/:0