如何在 DISPLAY=:0 上将 x11vnc 安装为 systemd 服务
首先,安装 x11vnc,例如使用
install_x11vnc.sh
sudo apt -y install x11vnc现在以运行 X11 会话的用户身份运行此脚本。脚本需要知道正确的用户以启动 x11vnc。
install-x11vnc-via-wget.sh
wget -qO- https://techoverflow.net/scripts/install-x11vnc.sh | sudo bash -s $USER这将安装类似这样的 systemd 服务
x11vnc.service
[Unit]
Description=VNC Server for X11
[Service]
Type=simple
User=uli
Group=uli
ExecStart=/usr/bin/x11vnc -display :0 -norc -forever -shared -autoport 5900
Restart=always
RestartSec=10s
[Install]
WantedBy=multi-user.target并自动在启动时启用并启动它。
你现在可以使用 VNC 连接到计算机,例如使用:
vncviewer_example.sh
vncviewer [hostname]Check out similar posts by category:
Linux
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow