Ssh – Starting x11vnc remotely when X server is already running

displaysshvncx11

I have a ubuntu linux machine that I have already logged into and X server is running (it is pass the login manager like gdm). I can access this machine through ssh. My goal is to start x11vnc on this machine and attach it to the X server that is already running.

When I ssh into the machine and start x11vnc, it says:

X11 was unable to open the X DISPLAY ":0", it cannot continue.

How can I start x11vnc on the remote machine if I don't have physical access to it and Xserver has already started. The reason I want to do this is because the remote machine has several windows open that I want to work on.

EDIT: I also tried x11vnc -find. This time it didn't give me that error message and was able to detect that the client was connected:

Got connection from client x.x.x.x
...
wait_for_client: find display cmd failed
wait_for_client: bad reply '
'

So it seems like -find command just delays the inevitable.

Thanks,

Best Answer

I was using gnome so what I did was simply give x11vnc the x authority file gnome was using. This was done by:

x11vnc -xauth /var/lib/gdb/:0.Xauth -display :0