Follow me on Twitter Twitter_16
Subscribe to my RSS feed Rss_16
Posted about 9 years ago

How to VNC to the primary display in ubuntu (display :0)

1) Install the package

sudo aptitude install x11vnc

2) Run the following command

ps wwaux | grep auth

This command should output something like this:

root      3838 10.1  1.7  13308  8840 tty7     Ss+  15:35   2:14 /usr/bin/X -br -nolisten tcp :0 vt7 -auth /var/run/xauth/A:0-LliKdB
erik      5156  0.0  0.1   2800   752 pts/0    R+   15:57   0:00 grep auth

Note the path after -auth, as you will need this for the next step

3) Add x11vnc service to xinetd

sudo nano /etc/xinetd.d/x11vnc

Enter this into the new file:

service x11vnc
{
        port            = 5900
        type            = UNLISTED
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = root
        server          = /usr/bin/x11vnc
        server_args     = -inetd -o /var/log/x11vnc.log -display :0 -auth */var/run/xauth/A:0-LliKdB* -many -bg
        disable         = no
}

Notice the server args, this is where you put the path you found in step 2.

4) Restart xinetd

sudo /etc/init.d/xinetd restart

5) You can now connect to display :0 from another machine by using a VNC client. For example:

sudo vncviewer vnchost:0

via: Ubuntu Forums

comments powered by Disqus