Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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,

share|improve this question

4 Answers 4

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
share|improve this answer
    
Very intriguing answer! This is useful elsewhere as well. –  Mei May 30 '10 at 18:02

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

share|improve this answer

For me

Description:    Debian GNU/Linux 6.0.5 (squeeze)
Release:        6.0.5
Codename:       squeeze

apt-cache policy gdm3
gdm3:
  Installiert: 2.30.5-6squeeze4

this worked well even if i log in remotely via ssh:

su -c "x11vnc -auth /var/run/gdm3/auth-for-username*/database -display :0 -forever -passwd foo"

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:

su -c "x11vnc -auth /var/run/gdm3/auth-for-username*/database -display :0 -forever -passwd foo -localhost"

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!

share|improve this answer

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

# vncserver :1

(starting as root was stupid)

Then I connected to this display using TigerVNC from my client computer

Connect to: a.b.c.d:1

Now I'm in the GUI as root(very stupid). I opened a terminal, and started x11vnc as my original user

# sudo -u milind x11vnc -many -display :0

Now I was able to

Connect to: a.b.c.d:0

Done! albeit in a very roundabout manner.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.