Software & AppsOperating SystemLinux

How To Connect to Ubuntu 18.04 Login Screen over VNC

Ubuntu 10

In this article, we’ll guide you through the process of connecting to the Ubuntu 18.04 login screen over VNC. This can be extremely useful for remote system administration or even for personal use when you need to access your system from a different location.

Quick Answer

To connect to the Ubuntu 18.04 login screen over VNC, you need to install and configure LightDM as the display manager and x11vnc as the VNC server. Once set up, you can connect to the login screen remotely using a VNC client.

What is VNC?

Virtual Network Computing (VNC) is a graphical desktop sharing system that allows you to remotely control another computer. It transmits the keyboard and mouse events from one computer to another, relaying the graphical screen updates back in the other direction, over a network.


Before we start, make sure you have the following:

  1. A system running Ubuntu 18.04.
  2. Sudo privileges on the system.
  3. A stable internet connection.

Step 1: Install LightDM

Ubuntu 18.04 uses GDM3 (GNOME Display Manager) by default. However, to connect to the login screen over VNC, we need to switch from GDM3 to LightDM.

To install LightDM, open your terminal and run the following command:

sudo apt install lightdm

This command uses the apt package handling utility to install the lightdm package. The sudo command is used to run the command as an administrator.

During the installation, you’ll be asked to choose the display manager. Select lightdm.

Step 2: Install x11vnc

The next step is to install x11vnc. This is a VNC server that allows you to view remotely the actual X11 display screen, not just an independent session as with some other VNC servers.

To install x11vnc, run the following command:

sudo apt install x11vnc

Step 3: Create a Systemd Service for x11vnc

Now, we need to create a systemd service for x11vnc. This will ensure that the VNC server starts automatically on boot.

To do this, create the file /etc/systemd/system/x11vnc.service with the following content:


ExecStart=/usr/bin/x11vnc -loop -nopw -xkb -repeat -noxrecord -noxfixes -noxdamage -forever -rfbport 5900 -display :0 -auth guess
ExecStop=/usr/bin/killall x11vnc


In this configuration:

  • ExecStart specifies the command to run when the service starts. The -loop option makes x11vnc restart whenever the X11 server restarts. The -nopw option disables password authentication. The -xkb and -repeat options handle keyboard issues. The -noxrecord, -noxfixes, and -noxdamage options disable various X11 workarounds that can cause problems. The -forever option makes x11vnc run until it’s explicitly stopped. The -rfbport 5900 option specifies the port on which the VNC server should listen. The -display :0 option tells x11vnc to connect to the first X11 display. The -auth guess option tells x11vnc to guess the Xauthority file location.
  • ExecStop specifies the command to run when the service stops.
  • Restart=on-failure and RestartSec=2 tell systemd to restart the service if it fails, waiting 2 seconds between attempts.
  • makes the service start when the system reaches the multi-user runlevel.

Step 4: Enable the x11vnc Service

The final step is to enable the x11vnc service so that it starts on boot. To do this, run the following command:

sudo systemctl enable x11vnc.service


You should now be able to connect to the Ubuntu 18.04 login screen over VNC. Remember to secure your VNC connection as it can be a security risk if left unprotected.

Note: If you want to switch back to GDM3 in the future, you can do so by running the following command:

sudo dpkg-reconfigure gdm3

This command reconfigures the package gdm3, allowing you to select it as the default display manager.

For more information on VNC, you can visit the official VNC documentation. If you encounter any issues, the Ubuntu community is a great resource for getting help.

What is the default VNC port?

The default VNC port is 5900.

How can I change the VNC server port?

To change the VNC server port, you need to modify the -rfbport option in the x11vnc service configuration file (/etc/systemd/system/x11vnc.service). Update the value of -rfbport to the desired port number.

How can I secure my VNC connection?

To secure your VNC connection, you can use SSH tunneling or set up a VPN. SSH tunneling encrypts the VNC traffic, while a VPN creates a secure network connection between your local machine and the remote system.

Can I connect to the Ubuntu 18.04 login screen using a VNC client from a different operating system?

Yes, you can connect to the Ubuntu 18.04 login screen using a VNC client from a different operating system. VNC is a cross-platform protocol, so you can use VNC clients available for Windows, macOS, Linux, and other operating systems.

How can I disable the x11vnc service?

To disable the x11vnc service, you can run the following command: sudo systemctl disable x11vnc.service. This will prevent the service from starting automatically on boot.

Can I use a different display manager instead of LightDM?

Yes, you can use a different display manager instead of LightDM. However, the steps mentioned in this guide are specific to switching from GDM3 to LightDM. If you want to use a different display manager, you will need to follow the appropriate installation and configuration steps for that display manager.

Leave a Comment

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