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.
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.
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.
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!