connecting ubuntu using vnc

user1667630 picture user1667630 · Dec 20, 2012 · Viewed 8.1k times · Source

I need to do a remote connection to a Ubuntu PC(need to see the UI) from another Ubuntu PC and Windows PC. I know that we can do that using VNC. Can anyone explain me with the steps or give a proper link which has the instructions.

I followed the following steps: Installed the vnc server in the Ubuntu machine to which I need to do remote access. I followed the instructions in the below link

http://www.ubuntu-unleashed.com/2007/10/setup-vnc-server-for-ubuntu-gutsy.html

When I do the 4th step:

x11vnc -forever -usepw -httpdir /usr/share/vnc-java/ -httpport 5800

I get

20/12/2012 02:12:02 passing arg to libvncserver: -httpport

20/12/2012 02:12:02 passing arg to libvncserver: 5801

20/12/2012 02:12:02 -usepw: found /home/sjayara5/.vnc/passwd

20/12/2012 02:12:02 x11vnc version: 0.9.12 lastmod: 2010-09-09  pid: 4821

20/12/2012 02:12:02 XOpenDisplay("") failed.

20/12/2012 02:12:02 Trying again with XAUTHLOCALHOSTNAME=localhost ...

20/12/2012 02:12:02 

20/12/2012 02:12:02 *** XOpenDisplay failed. No -display or DISPLAY.

20/12/2012 02:12:02 *** Trying ":0" in 4 seconds.  Press Ctrl-C to abort.

20/12/2012 02:12:02 *** 1 2 3 4 

20/12/2012 02:12:06 XOpenDisplay(":0") failed.

20/12/2012 02:12:06 Trying again with XAUTHLOCALHOSTNAME=localhost ...

20/12/2012 02:12:06 XOpenDisplay(":0") failed.

20/12/2012 02:12:06 Trying again with unset XAUTHLOCALHOSTNAME ...

20/12/2012 02:12:06 



20/12/2012 02:12:06 ***************************************

20/12/2012 02:12:06 *** XOpenDisplay failed (:0)



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

*** There may be "Xlib:" error messages above with details about the failure.

Some tips and guidelines:

Thanks

Answer

Nicholas Wilson picture Nicholas Wilson · Dec 20, 2012

Read your error message! It seems fairly clear you're running the commands from an SSH session or similar, since DISPLAY isn't set. Set it to the correct value (check what X11 sockets are in /tmp; you probably want ":0").

DISPLAY=":0"; export DISPLAY

You'll also want to set XAUTHORITY so x11vnc can connect! Dupe of this question.