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,
I was using gnome so what I did was simply give x11vnc the x authority file gnome was using. This was done by:
I found on my gentoo kde desktop this works great for when kde is already running.
x11vnc -xauth /var/run/xauth/A:0-bHJFac -display :0 -passwd "password" -forever -shared
For me
this worked well even if i log in remotely via ssh:
edit: you could also use e.g. ssvnc for a comfortable use of vnc over ssh. Just start the x11vnc like above but with the "-localhost" option:
then you can click on "Use SSH" in the ssvnc script and it would connect through ssh, so there is no need for x11vnc to listen globally!
I solved it in a very roundabout way, so I'm just going to detail how I did it, which is very suboptimal and involved. Others have already given elegant and short solutions.
The problem I faced was that x11vnc refused to start over SSH saying that it did not find any graphical display. So my solution to that was....
First, over SSH as root I started a TigerVNC server on the machine at display :1
(starting as root was stupid)
Then I connected to this display using TigerVNC from my client computer
Now I'm in the GUI as root(very stupid). I opened a terminal, and started x11vnc as my original user
Now I was able to
Done! albeit in a very roundabout manner.
Use
x0vncserver
instead:For my situation, my machine was auto logged in as UserX and I was ssh'ed into the machine and running the x11vnc command as UserY