Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: HOW TO: Resumable VNC Session Available at Startup

  1. #1
    Join Date
    May 2007
    Location
    Naples, FL
    Beans
    2
    Distro
    Ubuntu 6.06 Dapper

    Lightbulb HOW TO: Resumable VNC Session Available at Startup

    I have a 6.06 server up and running at home and wanted to be able to administer it while at work and/or where ever. VNC works great for this locally, but doesn't run at startup on default. A few simple changes can fix that and make it easy to login remotely from anywhere. I can later explain how I setup my Linksys router (WRT54GL updated with DD-WRT firmware) connect up to no-ip.com for dynamic/static IP purposes (I have a standard home cable setup) and use SSH to putty and work on my server from anywhere (if anyone is interested)

    This is not my original idea nor did I write any of this code. I compiled this from a number of sources and made it easy to understand (I hope).

    How to: Resumable VNC sessions locally or via SSH.


    1. Install x11vnc & xinetd package (if you have not already)


    Code:
    sudo apt-get install x11vnc xinetd

    2. Set the VNC passwd


    Code:
    sudo x11vnc -storepasswd yourpasswordhere /etc/x11vnc.pass

    3. Add x11vnc service to xinetd:


    Code:
    sudo gedit /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/lib/gdm/:0.Xauth -many -bg
    
            disable         = no
    
    }

    4. Configure GDM to run x11vnc when at loading time:


    Code:
    sudo gedit /etc/X11/gdm/Init/Default

    and this line to the file:


    Code:
    /usr/bin/x11vnc -rfbauth /etc/x11vnc.pass -o /tmp/x11vnc.log -forever -bg -rfbport 5900

    (you can change the port and other parameters)


    5. If you restart your PC at this stage you’ll only be able to login, then the GDM will kill your session. To avoid this we must change another file:


    Code:
    sudo gedit /etc/X11/gdm/gdm.conf

    now search for this line :

    #KillInitClients=true

    And change it to this:

    KillInitClients=false


    6. Restart xinetd (usually there is no need to reboot, but occasionally it might be required)


    Code:
    sudo /etc/init.d/xinetd stop
    
    sudo killall x11vnc
    
    sudo /etc/init.d/xinetd start

    7. Install OpenSSH-Server for remote connections...using putty or whatever...


    Code:
    sudo apt-get install openssh-server

    Restart your box, you will have resumable VNC sessions available on startup available via a secure shell.

    Download Putty at your remote location to login remotely.

    Thanks.

    Moon.
    Last edited by moonblink; July 2nd, 2007 at 01:13 PM.

  2. #2
    Join Date
    Jul 2007
    Beans
    12

    Re: HOW TO: Resumable VNC Session Available at Startup

    Great HOWTO, worked pretty well for me on 7.04, just have a couple questions.

    Quote Originally Posted by moonblink View Post
    4. Configure GDM to run x11vnc when at loading time:

    Code:
    sudo gedit /etc/X11/gdm/Init/Default
    and this line to the file:

    Code:
    /usr/bin/x11vnc -rfbauth /etc/x11vnc.pass -o /tmp/x11vnc.log -forever -bg -rfbport 5900
    This should be added to the very end of the file as I've done, or does it matter?

    Quote Originally Posted by moonblink View Post

    5. If you restart your PC at this stage you’ll only be able to login, then the GDM will kill your session. To avoid this we must change another file:


    Code:
    sudo gedit /etc/X11/gdm/gdm.conf

    now search for this line :

    #KillInitClients=true

    And change it to this:

    KillInitClients=false
    The only problem I'm having is that my vnc session is dropped right after login, so I have to reconnect to see the desktop. I assume this has something to do with the KillInitClients setting, although I've double checked that it's uncommented and set to false, and rebooted. Is there any reason it would not be reading the setting from my gdm.conf, or seems to be ignoring it?

  3. #3
    Join Date
    May 2007
    Location
    Naples, FL
    Beans
    2
    Distro
    Ubuntu 6.06 Dapper

    Re: HOW TO: Resumable VNC Session Available at Startup

    Indelible, yeah you can add it to the second to last line, right before the "end" line.

    Also regarding your VNC connection shutting down just after login, I had that same issue with 7.04 server. I could not get it to clear up so I went back to 6.06 and it worked like a charm...I changed the file several different ways to see if that was it on 7.04 and never got it to comply, its really just an inconvenience since you can just re-login and its all good.

    Thanks

    Moon.

  4. #4
    Join Date
    Jul 2007
    Beans
    2

    Re: HOW TO: Resumable VNC Session Available at Startup

    First off, good writeup, worked well, until...

    I upgraded to the new 2.6.22-9-generic kernel today. Now, when connecting, the password prompt is different. Has the VNC logo and is a different size. Minor point. Same password that I had before works when connecting to the box while it's displaying the GDM login. Upon logging in to X, the connection drops. Again, no biggie, used to happen before the kernel upgrade too. However, upon reconnecting via VNC, I get the error, "Failed to connect to server". My VNC client is the same as before, UltraVNC.

    Tried using the previous kernel, same problem.

    The guide I followed for the kernel upgrade is listed here:
    http://www.ubuntugeek.com/howto-upgr...isty-fawn.html

    I am undoubtedly a noob, but it doesn't look like any of the packages that the howto had me install were related to VNC, etc.

    Any help would be greatly appreciated, as this is a headless box and I have no means of interacting w/X otherwise. Thanks in advance.

    Update:

    I tried running
    Code:
     /usr/bin/x11vnc -display :0 -auth /var/lib/gdm/:0.Xauth -many -bg
    and that started x11vnc and allowed me to connect via VNC after I had logged into Gnome. Perhaps it has something to do w/xinetd that gets changed after upgrading kernels? Even though, as I said, using the previous kernel, same problem occured. I suspect a package was installed/changed that affected how xinetd works. I may be totally wrong though.

    Anyway, I'd like to get this working in the same fashion as it was previously, where no additional commands have to be manually run in order to VNC after logging in to GDM. Thanks
    Last edited by Kreychek; August 2nd, 2007 at 11:01 PM.

  5. #5
    Join Date
    Jul 2007
    Beans
    9

    Unhappy Re: HOW TO: Resumable VNC Session Available at Startup

    I set up as suggested. Am running on xubuntu, Fiesty 7.04 256MB RAM

    vnc viewer won't make a connection. I just get a window saying "The connection closed unexpectedly

    Do you wish to attempt to reconnect to max:1?"

    Clicking "Yes" just gets the same result.

    If I run it manually (even after the changes suggested) using sudo x11vnc it runs fine. No password of course.

    Any ideas where to look / start?

    Thanks - Chris
    Last edited by Linuxnz; August 24th, 2007 at 12:22 PM. Reason: Missed release details

  6. #6
    Join Date
    May 2007
    Beans
    810

    Re: HOW TO: Resumable VNC Session Available at Startup

    Great Post, it worked for me on the first try. The only problem but i guess it is not a problem really. When i enable desktop effects the screen doesn't update on the computer that i am using to remote control. So i can move the windows around, and they move on my ubuntu box, but on the other one nothing happens. I can even spin the desktop around and it shows the 1st desktop only, but the ubuntu machine spins.

    Maybe it is just too much information to send, so it crashes, not really a bug because there is no reason to use 3d effects on a machine you are connecting to. i just thought it was interesting.

  7. #7
    Join Date
    Jul 2007
    Beans
    9

    Smile Re: HOW TO: Resumable VNC Session Available at Startup

    I have fixed the issue with "The connection closed unexpectedly Do you wish to attempt to reconnect to max:1?" on my Xubuntu server.

    The problem was there is more than one gdm.conf file to fix with the KillInitClients=false.

    On my system there was also a file called gdm-cdd.conf which to me looked very much like the gdm.conf I had already edited.

    Hope this helps someone else.

    Thanks Moonblink it works very well. My Xubuntu NAS server is now easy to manage. Nice work.

    Regards - Chris

  8. #8
    Join Date
    Apr 2006
    Location
    Kiel, Germany
    Beans
    86
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: HOW TO: Resumable VNC Session Available at Startup

    Thanks for this great HOWTO. Also works on Gutsy with a little change to the location of the gdm configuration. It is now located directly under /etc/gdm. 4 and 5 should now look like this

    4. Configure GDM to run x11vnc when at loading time:

    Code:
    sudo gedit /etc/gdm/Init/Default
    and this line to the file:

    Code:
    /usr/bin/x11vnc -rfbauth /etc/x11vnc.pass -o /tmp/x11vnc.log -forever -bg -rfbport 5900
    (you can change the port and other parameters)

    5. If you restart your PC at this stage you’ll only be able to login, then the GDM will kill your session. To avoid this we must change another file:

    Code:
    sudo gedit /etc/gdm/gdm.conf
    now search for this line :

    Code:
    #KillInitClients=true
    And change it to this:

    Code:
    KillInitClients=false


    regards

    tom
    Last edited by rdd; October 31st, 2007 at 01:34 AM.

  9. #9
    Join Date
    Apr 2005
    Beans
    54

    Re: HOW TO: Resumable VNC Session Available at Startup

    Good stuff. Is there a way to setup a "virtual" session at startup? What I mean is, I have a headless Mythbuntu server connected to a TV, and it runs the MythTV frontend through xdm. I can get to Gnome on it by using FreeNX, and I've messed around with Xvnc a little, but I can't get either to load by itself on startup.

    So basically, I'd like a way to have a FreeNX or VNC session start by itself on the Mythbuntu server, and have a few GUI apps start on it (Azureus, I have to run it since it has autospeed and azsmrc), and be able to login to them and have them persist and all that fun stuff. Any ideas?

  10. #10
    Join Date
    Nov 2007
    Beans
    2

    Wink Re: HOW TO: Resumable VNC Session Available at Startup

    Hi everybody.
    Very nice how to & updates.
    I've only a problem. I follow the guide, but I would like that the server requires the password at each connection...
    I've done the
    Code:
    sudo x11vnc -storepasswd yourpasswordhere /etc/x11vnc.pass
    but the password is not requested by the server..
    How can I correct that?
    I've also used the
    Code:
    x11vnc -rfbauth /etc/x11vnc.pass
    but nothing...
    suggestions?

    Thanks!

    p.s. sorry for my English, I'm Italian...
    Last edited by zanolla; November 4th, 2007 at 11:02 PM.

Page 1 of 2 12 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
  •