Skip to content

Configure VNC on remote host

See general informations if needed.

Installation and configuration

Install using script

Copy this code your terminal:

wget https://www.cclaude.rocks/linux-wiki/remote-desktop-vnc-server-install.sh -O /tmp/remote-desktop-vnc-server-install.sh && bash /tmp/remote-desktop-vnc-server-install.sh && rm /tmp/remote-desktop-vnc-server-install.sh

Or download script.

Manual install

sudo apt update && sudo apt install -y x11vnc

Then create encrypted password file

sudo mkdir -vp /etc/x11vnc
sudo x11vnc --storepasswd /etc/x11vnc/vncpwd

Then enter password and confirm and press Y to write password to file.

Now X11 VNC Server is installed, but we need to configure it to auto start on system boot.

for that we will create systemd service to launch X11 VNC Server at boot time.

Create new file named x11vnc.service

cat <<EOF | sudo tee /lib/systemd/system/x11vnc.service
[Unit]
Description=Starting x11vnc service
After=multi-user.target

[Service]
Type=simple
ExecStart=$( which x11vnc ) -auth guess -forever -noxdamage -repeat -rfbauth /etc/x11vnc/vncpwd  -o /var/log/x11vnc.log -rfbport 5900 -shared

[Install]
WantedBy=multi-user.target

EOF

Reload all systemd daemons

sudo systemctl daemon-reload

Enable x11vnc.service at boot time.

sudo systemctl enable x11vnc.service

Start service (so you don't need to reboot)

sudo systemctl start x11vnc.service

# You can very service status using
systemctl status -l x11vnc.service

Okay, Now x11vnc server is running on port 5900.

WARNING

See issues:

Debugging

Check syslog

To read /var/log/syslog you need to be in adm group.

cat /var/log/syslog

Check x11vnc.service logs.

cat /var/log/x11vnc.log

Use debug on client side.