Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: HOWTO: x11vnc (vnc for display :0)

  1. #1
    Join Date
    Nov 2005
    Location
    Purdue
    Beans
    79

    HOWTO: x11vnc (vnc for display :0)

    x11vnc is very similar to vnc, except that it allows you to view display :0, the display that would currently be showing on your monitor if you were sitting at your computer.

    1. Install the package
    Code:
    sudo aptitude install x11vnc
    2. Run the following command
    Code:
    ps wwaux | grep auth
    This command should output something like this:
    Code:
    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 bolded path after -auth, as you will need this for the next step

    3. Add x11vnc service to xinetd
    Code:
    sudo nano /etc/xinetd.d/x11vnc
    Enter this into the new file:
    Code:
    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 bolded path, this is where you put the path you found in step 2.

    4. Restart xinetd
    Code:
    sudo /etc/init.d/xinetd restart
    5. You can now connect to display :0 from another machine by using a VNC client. For example:
    Code:
    sudo vncviewer vnchost:0
    A lot of this is thanks to Tichondrius' great VNC HOW-TO which is here. His post on using x11vnc is on page 7 of that thread. In his HOW-TO there was an issue where the connection would drop out whenever you logged in or out, but I believe I have rectified this problem by using the new method to find the path to use with the -auth option.

    Please let me know if there are any problems with this HOW-TO.

  2. #2
    Join Date
    Dec 2006
    Beans
    810

    Re: HOWTO: x11vnc (vnc for display :0)

    Hi,

    Newer versions of x11vnc (might not be in ubuntu yet) support automatic
    finding of the -auth authority file, and can also find both the DISPLAY and authority
    file using unix username and password login. This is the FINDDISPLAY
    stuff here: http://www.karlrunge.com/x11vnc/faq.html#faq-userlogin

    E.g.:

    Code:
    server_args     = -inetd -o /var/log/x11vnc.log -svc
    or -xdmsvc instead of -svc. The -find option may also be useful here.
    Last edited by krunge; January 28th, 2009 at 02:25 AM.

  3. #3
    Join Date
    Aug 2006
    Location
    North East England
    Beans
    576
    Distro
    Ubuntu

    Re: HOWTO: x11vnc (vnc for display :0)

    I have been trying to get this set up, but when I type
    Code:
    ps wwaux | grep auth
    to find the code for the -auth part, it just says
    -auth /var/lib/gdm/:0.Xauth
    Am I going wrong anywhere obvious?

    Cheers

  4. #4
    Join Date
    Aug 2006
    Location
    North East England
    Beans
    576
    Distro
    Ubuntu

    Re: HOWTO: x11vnc (vnc for display :0)

    Just realised I have only been trying to connect via SSH. Just tried it and it will connect direct, but not through SSH. Any ideas why that is then?

  5. #5
    Join Date
    Dec 2006
    Beans
    810

    Re: HOWTO: x11vnc (vnc for display :0)

    Am I going wrong anywhere obvious?
    No, that looks fine. /var/lib/gdm/:0.Xauth is where gdm(1) puts the server auth file. It's nice that the filename doesn't have a random part like the kdm and xdm servers do. Please send your entire /etc/xinetd.d/x11vnc (or equivalent) file.

    Just realised I have only been trying to connect via SSH. Just tried it and it will connect direct, but not through SSH. Any ideas why that is then?
    What was the full ssh command you ran, and the vncviewer command you ran? Do any errors or warnings get printed out (either by ssh, vncviewer, or in the x11vnc log file)?

  6. #6
    Join Date
    Nov 2005
    Location
    Buenos Aires, Argentina
    Beans
    216
    Distro
    Kubuntu 7.04 Feisty Fawn

    Re: HOWTO: x11vnc (vnc for display :0)

    When xinetd starts I get an error in daemon.log. Any idea what it may be?

    Mar 14 21:57:06 maverick xinetd[11740]: Reading included configuration file: /etc/xinetd.d/chargen [file=/etc/xinetd.conf] [line=14]
    Mar 14 21:57:06 maverick xinetd[11740]: Reading included configuration file: /etc/xinetd.d/daytime [file=/etc/xinetd.d/daytime] [line=28]
    Mar 14 21:57:06 maverick xinetd[11740]: Reading included configuration file: /etc/xinetd.d/discard [file=/etc/xinetd.d/discard] [line=26]
    Mar 14 21:57:06 maverick xinetd[11740]: Reading included configuration file: /etc/xinetd.d/echo [file=/etc/xinetd.d/echo] [line=25]
    Mar 14 21:57:06 maverick xinetd[11740]: Reading included configuration file: /etc/xinetd.d/time [file=/etc/xinetd.d/time] [line=26]
    Mar 14 21:57:06 maverick xinetd[11740]: Reading included configuration file: /etc/xinetd.d/x11vnc [file=/etc/xinetd.d/x11vnc] [line=28]
    Mar 14 21:57:06 maverick xinetd[11740]: removing chargen
    Mar 14 21:57:06 maverick xinetd[11740]: removing chargen
    Mar 14 21:57:06 maverick xinetd[11740]: removing daytime
    Mar 14 21:57:06 maverick xinetd[11740]: removing daytime
    Mar 14 21:57:06 maverick xinetd[11740]: removing discard
    Mar 14 21:57:06 maverick xinetd[11740]: removing discard
    Mar 14 21:57:06 maverick xinetd[11740]: removing echo
    Mar 14 21:57:06 maverick xinetd[11740]: removing echo
    Mar 14 21:57:06 maverick xinetd[11740]: removing time
    Mar 14 21:57:06 maverick xinetd[11740]: removing time
    Mar 14 21:57:06 maverick xinetd[11740]: bind failed (Address already in use (errno = 98)). service = x11vnc
    Mar 14 21:57:06 maverick xinetd[11740]: Service x11vnc failed to start and is deactivated.
    Mar 14 21:57:06 maverick xinetd[11740]: xinetd Version 2.3.14 started with libwrap loadavg options compiled in.
    Mar 14 21:57:06 maverick xinetd[11740]: Started working: 0 available services

  7. #7
    Join Date
    Aug 2005
    Location
    Fargo, ND, USA
    Beans
    1,499
    Distro
    Kubuntu 10.04 Lucid Lynx

    Re: HOWTO: x11vnc (vnc for display :0)

    This is what I use to connect to an already running server (on display :0):
    Code:
    #!/bin/bash
    
    usage="$0 [user@]remote_host"
    
    if [[ x$1 == x"" ]] ; then
        echo $usage
        exit 1
    fi
    
    ssh $1 'x11vnc -localhost -display :0 -scale 4/5 -bg' 
    vncviewer -via $1 -encodings 'copyrect tight zrle hextile' localhost:0
    All you need is X11Forwarding in ssh.
    Help yourself: Search the community docs or try other resources.
    Quote Originally Posted by Henry Spencer
    Those who do not understand Unix are condemned to reinvent it, poorly.
    Let science use your computer when you aren't: Folding@Home.

  8. #8
    Join Date
    Dec 2006
    Beans
    810

    Re: HOWTO: x11vnc (vnc for display :0)

    Mar 14 21:57:06 maverick xinetd[11740]: bind failed (Address already in use (errno = 9 ). service = x11vnc
    It looks like something else is already listening on port 5900.

    Check 'netstat -ant | grep 5900' output and (perhaps as root) 'lsof -P | grep 5900'

  9. #9
    Join Date
    Nov 2005
    Location
    Buenos Aires, Argentina
    Beans
    216
    Distro
    Kubuntu 7.04 Feisty Fawn

    Re: HOWTO: x11vnc (vnc for display :0)

    Quote Originally Posted by krunge View Post
    It looks like something else is already listening on port 5900.

    Check 'netstat -ant | grep 5900' output and (perhaps as root) 'lsof -P | grep 5900'
    That was it. I dunno why, krfb was still running. I killed it, then inmediately afterwards I restarted xinetd. Now it worked. Thanks a lot!

  10. #10
    Join Date
    Mar 2007
    Beans
    2

    Re: HOWTO: x11vnc (vnc for display :0)

    Very useful thread. Been following the steps to get x11vnc working on edgy 6.10 ubuntu.
    Managed to get it to work on the end on port 5900 but I'd like to point out a mistake on the karlrunge.com that had me scrathing my head for ages:

    x11vnc -display :0 -auth /var/gdm/:0.Xauth
    Please note that ubuntu's gdm is located at /var/lib/gdm/:0.Xauth. I missed out the word lib when I was writing my xinetd file.
    But now it even works on bootup! Thanks very much for sharing this with us

    Btw, edgy currently uses 0.8.2 of x11vnc.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •