1、安装 X11VNC
apt install x11vnc -y
2、配置访问密码:输两次
x11vnc -storepasswd /etc/x11vnc.pass
3、创建服务
vim /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
保存退出
4、修改防火墙配置,配置和启动服务
ufw allow 5900
systemctl enable x11vnc.service
systemctl daemon-reload