I would like to run x11vnc (or another VNC server) on my desktop, but I'm unable to find a way to get it to start before any users log in. Back when I was using vanilla Ubuntu 10.10 Vino did this by default. However, I can't find a way to do it now in Xubuntu.


I usually suggest an alternate VNC server, x11vncserver or FreeNX.

FreeNX how to and download info

x11 VNC and docs

This assumes that VNC is setup and run-able:

Copy the code block below into /etc/init.d/vncserver. The easiest way to do it is to copy it to your clipboard, run sudo -i && cat > /etc/init.d/vncserver && exit in a terminal, paste it in, and type Ctrl-D`. Be sure to change the USER variable to whatever user you want the VNC server to run under.

#!/bin/sh -e
# Provides:          vncserver
# Required-Start:    networking
# Default-Start:     3 4 5
# Default-Stop:      0 6


# The Username:Group that will run VNC
export USER="mythtv"

# The display that VNC will use

# Color depth (between 8 and 32)

# The Desktop geometry to use.

# The name that the VNC Desktop will have.

OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"

. /lib/lsb/init-functions

case "$1" in
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"

log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"

$0 stop
$0 start

exit 0

Make the script executable with sudo chmod +x /etc/init.d/vncserver.

Then, run sudo update-rc.d vncserver defaults. This adds the appropriate symlinks to the vncserver script so that it is sent the start and stop commands at the appropriate time.

Note: you may need to use sudo update-rc.d vncserver 99 instead if the job is running too early in the boot process.

To start the server without rebooting, run sudo /etc/init.d/vncserver start

Finally, connect to your server with a VNC client on port 590X, where X is the value of "DISPLAY" in the vncserver script


  • the delayed sequence startup command should be sudo update-rc.d vncserver defaults 99, I think. – Christoph Sep 9 '14 at 17:27
  • Everything works great except that I don't have rights to network or the trash can for some reason. askubuntu.com/questions/722802/… – Donny V. Feb 5 '16 at 3:08

My solution:

  1. Go to the desktop sharing and allow it to sharing and put a good password. (click off to allow permissions)
  2. Go to the Screen and set it to lock after 30 seconds.
  3. Go to users and allow an automatic login.

The vino server starts and you should be able to attach to it. You can use ssh to create a tunnel for VNC if you need to secure it (I used PUTTY and that worked very well). You can also enable the firewall and just allow traffic from a specific address. This solution has worked for me in over 20 Ubuntu boxes.


What happens when you try: (?)


.. and add this in Autostarted Apps, to start vino server:



Try this:

Start a VNC Server on Ubuntu on Boot


  • This only starts the app AFTER login. I wanted to start it BEFORE I even log in. – PHLAK Dec 9 '11 at 21:55
  • added possible solution .. – david6 Dec 11 '11 at 1:02
  • 2
    solution outdated. – vainolo Jan 25 '12 at 17:51
  • Someone said this was outdated but I just did that today and it worked just fine. A couple of warnings running the update-rc.d command but it worked. – John Martin Jun 26 '17 at 23:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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