Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a server running Ubuntu 12.10 and need to be able to remote to this server without being logged-in.

I have found many solutions, but none seem to work with 12.10.

Can anyone give me step-by-step instructions on how to configure x11vnc to start as a service (prior to user login) so that when connecting with VNC I will be presented with a graphical login screen?

I'm new to Linux so please give as much detail as possible in your responses/comments.


share|improve this question

3 Answers 3

Install x11vnc:

sudo apt-get install x11vnc

Create a password for your user:

x11vnc -storepasswd

If you have ssh setup you can use it to start x11vnc assuming you are logged in already, but remember to tell it to use your password file:

x11vnc -usepw

If you are not logged in you will get an error with the explanation:

If NO ONE is logged into an X session yet, but there is a greeter login
program like "gdm", "kdm", "xdm", or "dtlogin" running, you will need
to find and use the raw display manager MIT-MAGIC-COOKIE file.
Some examples for various display managers:

 gdm:     -auth /var/gdm/:0.Xauth
          -auth /var/lib/gdm/:0.Xauth
 kdm:     -auth /var/lib/kdm/A:0-crWk72
          -auth /var/run/xauth/A:0-crWk72
 xdm:     -auth /var/lib/xdm/authdir/authfiles/A:0-XQvaJk
 dtlogin: -auth /var/dt/A:0-UgaaXa

Assuming you are using lightdm for the login you can fix this problem you can start x11vnc with the command:

sudo x11vnc -xkb -noxrecord -noxfixes -noxdamage -display :0 -auth /var/run/lightdm/root/:0 -usepw

I am not sure this is the best idea to run x11vnc as root. Maybe someone could edit with a way to access the login without using sudo.

Once this is running you should be able to connect using a vnc client such as krdc (for KDE). You might want to use GNU Screen to keep x11vnc running without needing the ssh session open

I was able to figure this out using http://ubuntuforums.org/showthread.php?t=2039022.

share|improve this answer
You can run x11vnc as a normal user, no problem. For example: ssh to the host and run x11vnc -safer -forever -display :0 2>&1 & in a tmux session (good practice), it'll run under $USER. –  Terry Wang Jul 17 '13 at 5:43
Also, just for reference, in order to change the viewport: superuser.com/questions/270608/… –  Wtower Dec 19 at 9:25

Here's how:

  1. Install X11VNC server : sudo apt-get x11vnc (Or through Ubuntu Software Center -> X11VNC Server)
  2. sudo mkdir /etc/x11vnc
  3. sudo x11vnc -storepasswd in /etc/x11vnc/passwd
  4. sudo x11vnc -storepasswd /etc/x11vnc/passwd
  5. enter the password you want to set for VNC access
  6. choose y to save pass
  7. sudo nautilus
  8. from within root nautilus, create an empty file in /etc/init called x11vnc.conf
  9. Paste this into the file:

start on login-session-start


sudo x11vnc -xkb -forever -auth /var/run/lightdm/root/:0 -display :0 -rfbauth /etc/x11vnc/passwd -rfbport 5900 -bg -o /var/log/x11vnc.log

end script

  1. Save and close
  2. Restart Ubuntu
  3. That's it! You should now be able to connect with any VNC client even before login.
share|improve this answer

Please have a look at this, it is already asked. http://ubuntuforums.org/showthread.php?t=45565

share|improve this answer
This is a link only answer. It is better to answer the question properly, and then give the link as a reference or accreditation. –  fabricator4 Dec 17 '12 at 19:02
The link above only configures VNC to be started at the time a user logs-in, which is a problem since you have to be logged-in before you can login with VNC. I want VNC to start prior to this so that onces I'm connected, I can login as any user. –  user115250 Dec 17 '12 at 19:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.