Friday, July 18, 2008

Taking control on a PC stuck at GDM

Have you ever been in the situation where you PC at work have rebooted and is now sitting at the GDM display waiting for you to enter a username and password ? Well this happened few times to me. The solution is rather simple. You only need to have an ssh access to your PC.

1 ) Logon to your PC using your ssh access.
2 ) install (if not already there) x11vnc : sudo apt-get install x11vnc
3 ) The tricky part is that gdm using a different xauth file than X11 server. So you need to find out which and where this file is. A simple ps -ef | grep gdm will give you the answer :

jboismar-desktop ~ # ps -ef | grep gdm
root 5683 1 0 11:12 ? 00:00:00 gdm
root 5684 5683 0 11:12 ? 00:00:00 gdm
root 6300 5684 0 11:31 tty7 00:00:00 /usr/bin/X :0 -br -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7
gdm 6313 5684 0 11:31 ? 00:00:01 /usr/lib/gdm/gdmgreeter
root 6320 5726 0 11:33 pts/0 00:00:00 grep --colour=auto gdm

The part you need is : -auth /var/lib/gdm/:0.Xauth

4 ) then you launch x11vnc with this argument. I usually use root :
jboismar-desktop ~ # x11vnc -auth /var/lib/gdm/:0.Xauth

The last lines should look like this :
18/07/2008 11:35:18 WARNING: the warning message printed above for more info.
18/07/2008 11:35:18

The VNC desktop is: jboismar-desktop:0
PORT=5900

******************************************************************************
Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?

The scheme stores pixel data offscreen on the VNC viewer side for faster
retrieval. It should work with any VNC viewer. Try it by running:

x11vnc -ncache 10 ...

more info: http://www.karlrunge.com/x11vnc/#faq-client-caching


5 ) You can then run a vnc client to access your remote screen. Once you login, GDM will terminate to start the X server. Your x11vnc program will also terminate at this point.