Ubuntu and VNC

A few weeks ago I gave [tag]Ubuntu[/tag] another chance. The update bug was corrected and now I could enjoy my Ubuntu box without losing too much time with bugs. My ULAMP (the U is from Ubuntu) box was now ready to work, the only thing missing was the remote access. I installed [tag]SSH[/tag] and explored the [tag]Remote Desktop[/tag] feature that comes with Ubuntu. [tag]VNC[/tag] based, worked well, fast and functional, but when you logoff there’s no more Remote Desktop available. I needed VNC available from the login screen, or [tag]GDM[/tag] in Gnome/Ubuntu. So here’s a quick how to:

First, disable Desktop Sharing under System -> Preferences -> Remote Desktop.

Now install x11vnc, you can do this with [tag]apt-get[/tag] or [tag]Synaptics[/tag], this package is available in the Community Maintained (Universe) repository.

Now with [tag]x11vnc[/tag] installed, you will need to create a password file:

sudo x11vnc -storepasswd yourpasswordhere /etc/x11vnc.pass

Then configure GDM to run x11vnc when at loading time:

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

and this line to the file:

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

(you can change the port and other parameters)

So far so good, but 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:

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

now search for this line :


And change it to this:


Restart you PC and now you have VNC at login time. 🙂

User Input

  • I suggest you to use FreeNX instead of VNC. FreeNX compresses Xlib so it’s much faster. For example, on my 100Mbps network, I access another machine like I was in mine! Amazingly fast.

  • I haven’t tried that, but it seems that it gives you the same as VNC on Windows, you log in to the console of the machine (everything shows up on the locally attached monitor), isn’t it?

    Another way to do this is to have a remote VNC session via XDMCP (X11 remote login). I’ve written about it here (portuguese): http://tudo-sobre-nada.blogspot.com/2005/03/vnc-xdmcp.html

  • Ricardo says:

    Carlos: Yes, with this method you see everything that shows up on the locally attached monitor. It’s usefull if you want to explain or share a desktop.

    Mário: I had FreeNX installed once on my Suse box, but I needed the VNC solution so I could share the desktop. FreeNX acts more like Terminal Services in Windows, but thanks for the tip. I got both solutions working 🙂

  • Glenn R. Cruz says:

    Your guide was a big help. I could login without any problem = )

  • Steve says:

    It works like a charm – even on my Mac Mini. Thank You!

  • Ronald says:

    Hi. thanks for the clear explanation. It works pretty well.

    There is one problem though. I can now login using VNC, but I cannot logout. When I choose logout from the system menu, the (VNC) screen does not update anymore.

    Does any one know how to fix this.

    Thanks in advance!

  • Juschka says:

    Thanks, works perfectly for me.

  • anonymous says:

    Note to users on Ubuntu 6.0.6:

    Instead of editing

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

    you have to make the change to

    sudo gedit /etc/X11/gdm/gdm.conf-custom

    for it to work.

  • […] I’m trying to re-purpose an Akimbo set-top box as a Mythtv frontend. I’ve gotten Ubuntu onto the hardware but I’m having some issues configuring  Xorg. Most of the problem stems from the fact that there is no vga out, only tv-out. In an attempt to get X squared away, I’ve installed XFCE, with GDM as the desktop manager. But I realized that once GDM starts, I didn’t have a way to control the console. This guy gave me my answer. […]

  • stelios says:

    Everything works fine, thanks for the info, very helpfull:)
    1 problem only: when I login my VNC client(windows platform) closes instantly…
    any ideas on how to resolve this?

  • stelios says:

    Sorry guys ignore my previous comment, I was in too much of a hurry,
    once again thanks

  • […] Ubuntu and VNC Un très bon tutorial pour se connecter à une machine Ubuntu en n’utilisant que VNC. Ca va remplacer toutes mes feintes avec NX/XDMCP/whatever (tags: network reference remote ubuntu vnc documentation tutorial) […]

  • […] D’abord pour la connexion, où j’ai remplacé NX par VNC+GDM, qui marche très bien, et permet en bonus d’accéder physiquement à l’écran sur lequel on travaille à distance (lorsque par exemple on a changé l’adresse IP de la machine pour la passer en fixe). […]