How to Setup X11VNC Server on Ubuntu or Kubuntu
Updated On: Oct. 31, 2024 Author: Kevin

How to Setup X11VNC Server on Ubuntu or Kubuntu

Setting up a remote desktop server can significantly enhance your productivity, especially when you need to access your Ubuntu or Kubuntu system from another device. The X11VNC server provides a simple yet effective way to share your desktop environment over a network, allowing for seamless remote access. In this guide, we will walk you through the step-by-step process of installing and configuring X11VNC on your system, ensuring you can connect remotely and securely. Whether you're troubleshooting, working from a different location, or simply need to access your files, this setup will empower you to manage your system with ease.

 

Note: The X11VNC server requires a monitor to be plugged in for it to function correctly. If no monitor is connected, the server may not work as intended. For a different setup without a monitor, for example, an Ubuntu or Kubuntu VM with a desktop, please refer to my other guide. You can find it here.

 

Step 1: Installing X11VNC

First things first, let’s update the system's repository index and install X11VNC.

sudo apt-get update
sudo apt-get install x11vnc

Enter your password when prompted and wait for the installation to complete.

 

Step 2: Setting Up a Password

After installation, create a password for the X11VNC server for security.

x11vnc -storepasswd

Follow the prompts to set and confirm your password. It will be stored in a file named .vnc/passwd in your home directory.

 

Step 3: Start the X11VNC Server

Initiate the X11VNC server using the password you've set and specify your current X11 session:

x11vnc -usepw -display :0

The -usepw option instructs the server to use the password you’ve set.

Your X11VNC server is now operational and ready for connections using any VNC client.

 

Step 4: Making X11VNC Start at Boot

To ensure the X11VNC server starts automatically during boot, let's create a systemd service.

sudo nano /etc/systemd/system/x11vnc.service

Copy and paste the following text into the file (replace kevin with your actual username):

[Unit]
Description=Start X11VNC at startup.
After=multi-user.target
[Service]
Type=simple
User=kevin
Environment=DISPLAY=:0
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/kevin/.vnc/passwd -rfbport 5900 -shared
Restart=on-failure
[Install]
WantedBy=multi-user.target

Save the file, then reload the systemd manager configuration:

sudo systemctl daemon-reload

Enable the service to start on boot:

sudo systemctl enable x11vnc.service

Start the service immediately without rebooting:

sudo systemctl start x11vnc.service

Check the service status:

sudo systemctl status x11vnc.service

Your X11VNC server will now automatically start every time your computer boots up.

I hope this guide helps you set up X11VNC smoothly for remote desktop sharing!