設定密碼
x11vnc 遠端控制畫面是傳輸XWindows整個畫面,與其他的vnc server不同, 在使用時建議一定要先設定密碼做好最低限度的保護。
sudo x11vnc -storepasswd [你的密碼] /etc/x11vnc.passwd
建立 Systemd Service檔案
使用編輯器建立x11vnc.service
,如:nano x11vnc.service
[Unit] Description=VNC Server After=multi-user.target network.target [Service] Restart=always # Replace this with x0vncserver from TigerVNC in Ubuntu 18.04. # Set password by running `sudo x11vnc -storepasswd [PASSWORD] /etc/x11vnc.passwd` ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.passwd -rfbport 5900 -shared [Install] WantedBy=multi-user.target
存檔後記住x11vnc.service
的路徑,等下會複制到對應的目錄。
安裝 Servce 檔案至 Systemd
sudo cp [path to]/x11vnc.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable x11vnc.service
啟動x11vnc
sudo systemctl start x11vnc
啟動後查看一下執行是否正常
sudo systemctl status x11vnc
danny@EDY-G41MT-D3:~$ sudo systemctl status x11vnc ● x11vnc.service - X11VNC Server Loaded: loaded (/lib/systemd/system/x11vnc.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2022-11-03 09:53:54 CST; 31min ago Main PID: 913 (x11vnc) Tasks: 2 (limit: 9337) Memory: 16.7M CPU: 30.635s CGroup: /system.slice/x11vnc.service ├─913 /usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.passwd -rfbport 5900 -shared └─916 /usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.passwd -rfbport 5900 -shared Nov 03 10:07:07 EDY-G41MT-D3 x11vnc[916]: 03/11/2022 10:07:07 Statistics events Transmit/ RawEquiv ( saved) Nov 03 10:07:07 EDY-G41MT-D3 x11vnc[916]: 03/11/2022 10:07:07 FramebufferUpdate : 182 | 0/ 0 ( 0.0%) Nov 03 10:07:07 EDY-G41MT-D3 x11vnc[916]: 03/11/2022 10:07:07 ZRLE : 508 | 151060/ 9056768 ( 98.3%) Nov 03 10:07:07 EDY-G41MT-D3 x11vnc[916]: 03/11/2022 10:07:07 TOTALS : 690 | 151060/ 9056768 ( 98.3%) Nov 03 10:07:07 EDY-G41MT-D3 x11vnc[916]: 03/11/2022 10:07:07 Statistics events Received/ RawEquiv ( saved) Nov 03 10:07:07 EDY-G41MT-D3 x11vnc[916]: 03/11/2022 10:07:07 PointerEvent : 259 | 1554/ 1554 ( 0.0%) Nov 03 10:07:07 EDY-G41MT-D3 x11vnc[916]: 03/11/2022 10:07:07 FramebufferUpdate : 509 | 5090/ 5090 ( 0.0%) Nov 03 10:07:07 EDY-G41MT-D3 x11vnc[916]: 03/11/2022 10:07:07 SetEncodings : 1 | 24/ 24 ( 0.0%) Nov 03 10:07:07 EDY-G41MT-D3 x11vnc[916]: 03/11/2022 10:07:07 SetPixelFormat : 1 | 20/ 20 ( 0.0%) Nov 03 10:07:07 EDY-G41MT-D3 x11vnc[916]: 03/11/2022 10:07:07 TOTALS : 770 | 6688/ 6688 ( 0.0%)
The post x11vnc 整合至 systemd 開機自動執行 appeared first on 可丁丹尼 @ 一路往前走2.0.