x11vnc

2024-02-04  本文已影响0人  iVikings
sudo apt purge x11vnc
sudo apt-get install x11vnc
x11vnc -storepasswd
chmod o=rw ~/.vnc/passwd
sudo x11vnc -forever -shared -rfbauth ~/.vnc/passwd
sudo apt-get install x11vnc
x11vnc -storepasswd
chmod o=rw ~/.vnc/passwd
sudo cp /home/user/.vnc/passwd /etc/x11vnc.pass
sudo x11vnc -forever -shared -rfbauth ~/.vnc/passwd
ps -ef | grep -i vnc
sudo kill -9 PID

开机自启动

方案一

创建并编辑一个新的systemd服务文件。输入以下命令打开文件:

sudo nano /etc/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 /home/user/.vnc/passwd -rfbport 5900 -shared
 
[Install]
WantedBy=multi-user.target

保存并退出文件。
输入以下命令以重载systemd服务文件:

sudo systemctl daemon-reload
sudo systemctl enable x11vnc.service
sudo systemctl start x11vnc.service
sudo systemctl status x11vnc.service

参考:https://blog.csdn.net/weixin_42735544/article/details/129778638

方案二

配置x11vnc为跟随系统自动启动

sudo touch /etc/init/x11vnc.conf
sudo chmod a+w /etc/init/x11vnc.conf
start on login-session-start
script
x11vnc -display :0 -auth /var/run/lightdm/root/:0 -forever -bg -o /var/log/x11vnc.log -rfbauth /etc/x11vnc.pass -rfbport 5900
end script

参考: https://www.cnblogs.com/baixf-xyz/p/16777559.html

上一篇下一篇

猜你喜欢

热点阅读