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. 🙂

13 thoughts on “Ubuntu and VNC”

  1. 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.

  2. 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 🙂

  3. 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!

  4. 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.

  5. 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?

Comments are closed.