Enable Vino VNC Server for Login Manager (GDM) in Ubuntu

I have been a big fan for Remote Desktop in Windows XP/Server/Vista platform because you get a native display resolution of your client monitor and file/printer share is supported; however, for Windows 2000 or linux distributions, I do not have the option.  There is an alternate option for Windows 2000 or linux distribution which is VNC.

For Windows platform, it looks like RealVNC and UltraVNC are the most popular ones while linux has many different VNC servers.

In this example, I would like to introduce a way to enable a built-in Vino VNC server for Ubuntu distribution.

1. After logging into Ubuntu, open up Remote Desktop option (System -> Preferences -> Remote Desktop)

2. Check “Allow other users to view your desktop” and “Allow other users to control your desktop” – this is to let others, others would be me in my case, take control of this machine

3. Uncheck “Ask you for confirmation” – when VNC is connected, VNC server will ask for a confirmation to local user.  In my case, this machine will not have a local logged user since it does not have a monitor

4. If possible, assign a password – Having a password should be better than not having one even though VNC still lacks encryption and strong authentication

At this point, VNC server is just enabled with some settings; however, Vino server does not start until a user logs in.  This means that Vino server is not running at User Login screen – where a user types username and password.  In my case, this was not feasible since the machine will not have a monitor (nor keyboard/mouse).

5. Edit /etc/gdm/Init/Default – this gets run when gdm starts (at Login Screen)

emacs /etc/gdm/Init/Default

6. Add the following line right before exit 0 at the end of the file – Vino server runs when gdm starts up

/usr/lib/vino/vino-server &

Vino server starts up when gdm starts up; however, when username and password is typed in, gdm kill this vino-server meaning VNC connection will be terminated.  To prevent this,

7. Edit /etc/gdm/gdm.conf with your favorite text editor

emacs /etc/gdm/gdm.conf

8. Find a commented option KillInitClients=true.  Uncomment it and change it to false and save it. – this prevents vino-server from being killed right after login

KillInitClients=false

Now, you should be able to connect to the machine using VNC

29 Replies to “Enable Vino VNC Server for Login Manager (GDM) in Ubuntu”

  1. Nice post. I tried it on my ubuntu installation and vino-server is getting started when gdm is run. But then, when I log in via vnc I get a totally black screen…

    Do you have any idea what this could be?

    Thanks in advance!

  2. Leon, what I would check first is the connection between the server and the client; however, it looks like your VNC connection is good since you can log in. However, just to make sure there is no connection issue.
    telnet [HOSTNAME] 5900

    Second, I would check any firewall software you are using. I found that Symantec products have issues with VNC protocol often times so disable all firewall and try it.

    Last, I would check different VNC clients because there could be version incompatibility. I personally recommend UltraVNC Viewer.

  3. Thanks you very much! I was able to achieve the GDM login screen from VNCviewer. I too had the similar issue of walking to the machine and actually typing in username and password before I could start using remote viewer.

    Thank you!

  4. This mostly works on Ubuntu 9.04 workstation, except that the system pops up a dialog asking if I want to allow a remote connection.

    “Another user is trying to view your desktop.”

    Once I physically go to the system and plug in a monitor and keyboard I can click allow. Of course, the point of the exercise is to allow vnc connections without having to give permission from the terminal.

    Yes, I did set the profile for myself to allow without asking….

    Woah! I just had an idea as I was typing the above sentence… I had set everything for my user account, not root.

    In the /etc/gdm/gdm.conf I edited the to lines to allow root login. (AllowRoot=true & AllowRemoteRoot=true).

    Note: Root is enabled root for normal terminal login.

    sudo passwd root

    To relock it (default for Ubuntu)

    sudo passwd -l root

    I logged in as root, configured remote desktop as described in steps 1 – 4. Turned off access for root login and it worked!

    Thanks for the great help in your blog Jake.

  5. Oh, I forgot….

    Please add to my original post…

    PS — Leon, this may be the answer to your black screen issue. Sometimes I had the same blue screen for vncviewer or no screen at all.

  6. instead of using vino-server, you could also use x11vnc.

    I have also found that to speed up ultra slow connections , for my hardware I needed to use the -nodamage flag. I found this out by monitoring the vnc log file as created by x11vnc :

    in /etc/gdm/Init/Default use:

    /usr/bin/x11vnc -rfbauth $home/.vnc/vncpasswd -o /var/log/x11vnc.log -noxda
    mage -forever -bg

    ( you can set your password by using vncpasswd ) – if you don’t want a password, skip the -rfbauth vncpasswd switch.

  7. Bummer.. It didn’t work for me. Stuck once protocol had been negotiated. Internal and externally both the same. Once I changed the two back. I am able to login once I am logged in locally.

  8. I confirm that sre’s comment dated Apr, 28, 2009 resolved issue of connecting to Vino server via SSH tunnel for me.

  9. This system always had work for me in the past.
    but now I istalled a fresh copy of ubuntu 9.10 server x86_64 and now it doesnt work.
    it stuck in “the protocol had been negociated”.

  10. Hi,
    I had similar problems to some mentioned here (“stuck when protocol being negotiated”) on Ubuntu 9.10.
    Turned out I had to enable connections to vino not related to my user account. To do this run “sudo vino-preferences” and duplicate the settings instructed here.
    Enjoy!

  11. Steps work fine in Ubuntu 10.* if you change the gdm configuration to be in:

    /etc/gdm/custom.conf

    and add:

    [daemon]
    KillInitClients=false

    Also, as Redshirt has said, enable the settings for it:

    sudo vino-preferences

    and the user account.

  12. Hi, I create the custom.conf with

    [daemon]
    KillInitClients=false
    I have ubuntu 10.10, but vino don’t work…
    I don´t understand the Redshirt …
    Can you help???
    Thanks

  13. @Zully In your normal login, you need to setup your vino through System>Preferences>Remote Desktop. Then in terminal you type: sudo vino-preferences and set those settings to be identical to the previous ones (i.e. as normal user through System>Preferences>Remote Desktop). That’s what @Redshirt meant.

  14. Pingback: Vino Server
  15. Pingback: Gnome VNC
  16. This has been bugging me forever. Thank you VERY much. Now I don’t have to turn on the monitor just to log into my Ubuntu box. Much appreciated 🙂

  17. I just need to comment this cuz i have big problems whit this! You need to enable th vino from the root, so if you have a own user name and a root you need to login to the root to enable it else it won´t work

    / Anton

  18. Found that old article useful, but had problems with the keyboard layout on a Fedora F18 server.

    In /etc/gdm/Init/Default I added
    localectl set-x11-keymap “de” “” “nodeadkeys” “”

    just before
    /usr/libexec/vino-server &

    to ensure proper keyboard layout.

    The KillInitClients=false was added in /etc/gdm/custom.conf instead of /etc/gdm/gdm.conf

  19. My keyboard mapping needed even more tunig. So I have now at the end of /etc/gdm/Init/Default:

    #ensure proper keymapping
    ./etc/profile
    setxkbmap -layout de -variant nodeadkeys
    localectl set-x11-keymap “de” “” “nodeadkeys” “”
    /usr/libexec/vino-server &

    The relevant part of /etc/profile is:

    LANG=”de_DE.utf8″
    LC_CTYPE=”de_DE.utf8″
    LC_NUMERIC=”de_DE.utf8″
    LC_TIME=”de_DE.utf8″
    LC_COLLATE=”de_DE.utf8″
    LC_MONETARY=”de_DE.utf8″
    LC_MESSAGES=”de_DE.utf8″
    LC_PAPER=”de_DE.utf8″
    LC_NAME=”de_DE.utf8″
    LC_ADDRESS=”de_DE.utf8″
    LC_TELEPHONE=”de_DE.utf8″
    LC_MEASUREMENT=”de_DE.utf8″
    LC_IDENTIFICATION=”de_DE.utf8″
    LC_ALL=

  20. Just for the record, the settings in Linux Mint (MATE) 14 is very similar…
    In /etc/mdm/Init/Default add in the line:
    /usr/lib/vino/vino-server –sm-disable &
    Before the “exit 0” bit.

    Then in /etc/mdm/mdm.conf add in the line:
    KillInitClients=false
    Underneath the [deamon] part.

    Voila! Works like a charm!

  21. does this work with unity? I mean is unity still using gdm or another login screen software?
    If not, can a similar trick work by editing the corresponding conf file in unity login manager?
    best,
    -a-

  22. Hi all.

    I have odroid with lubuntu 14.04 it uses lightdm to boot up.
    Where can i find some identical config to autostart in lightdm

Leave a Reply

Your email address will not be published. Required fields are marked *