加上选项

参考 

 

使用x11vnc作为vncserver端

1 安装x11vnc

sudo apt-get update
sudo apt-get install x11vnc

 

2 生成密码

x11vnc -storepasswd

Enter VNC password: *********
Verify password: *********  
Write password to /home/USERHOME/.vnc/passwd?  [y]/n y
Password written to: /home/rahul/.vnc/passwd

 

3 开启服务

ExecStart=/usr/bin/x11vnc -auth guess -once -loop -noxdamage -repeat -rfbauth /home/USERNAME/.vnc/passwd -rfbport 5900 -shared -capslock -nomodtweak

ps:之前遇到了用vnc-viewer连接,键盘Caps
Lock和小键盘错位的问题,加上选项

-capslock -nomodtweak就好了。

也可以编辑 /lib/systemd/system/x11vnc.service文件,设为开机启动

[Unit]
Description=Start x11vnc at startup.
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -once -loop -noxdamage -repeat -rfbauth /home/rd/.vnc/passwd -rfbport 5900 -shared -capslock -nomodtweak

[Install]
WantedBy=multi-user.target

然后用systemctl设置

sudo systemctl daemon-reload
sudo systemctl enable x11vnc.service

4 用vnc-viewer连接即可。