安装X11VNC
sudo apt install x11vnc -y
配置访问密码:
sudo x11vnc -storepasswd /etc/x11vnc.pass
创建服务:
vi /lib/systemd/system/x11vnc.service
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target
配置防火墙,配置和启动服务
sudo ufw allow 5900
sudo systemctl enable x11vnc.service
sudo systemctl daemon-reload
重启