Ubuntu下安装
sudo apt install x11vnc -y
设置访问密码
sudo x11vnc -storepasswd /etc/x11vnc.pass
编辑配置文件
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
配置防火墙
sudo ufw allow 5900
开机启动服务
sudo systemctl enable x11vnc.service
sudo systemctl daemon-reload
重启系统后查看服务状态
sudo systemctl status x11vnc.servic