Wednesday, May 18, 2016

x11vnc xauth

I've had problems lately starting x11vnc (to connect to :0.0) when I'm starting it over ssh.  I don't want x11vnc running all the time, so I don't start it when I'm at work.  But when I need it I'm *not* on the desktop in question, instead I'm remote.

I found the solution at ubuntuforums:

http://ubuntuforums.org/showthread.php?t=1314958

I do run screen on the remote desktop (my work desktop), and I generally start screen when X is already up, so *that* has the correct $XAUTHORITY entries.  So I can just connect to the running screen instance and do:

echo $XAUTHORITY


That will have something (from the ubuntuforums link above):

/var/run/gdm/auth-for-fred-s0G6r1/database


and, from ssh, I can use that:

x11vnc -display :0 -auth /var/run/gdm/auth-for-fred-s0G6r1/database

I should probably just have .bashrc detect if there's a $XAUTHORITY variable and if there is, echo it out to a file that I can then just source :-).