How to Setup X11VNC Server on Ubuntu or kUbuntu
Author: Kevin
Updated: Nov. 09, 2023
Category: Linux

How to Setup X11VNC Server on Ubuntu or kUbuntu

X11VNC Setup Guide for Ubuntu and Linux Mint



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 "YOURUSERNAME" with your actual username):



[Unit]
Description=Start X11VNC at startup.
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/YOURUSERNAME/.vnc/passwd -rfbport 5900 -shared

[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

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!