先安装VNCServer
sudo apt-get install x11vnc -y
设置vnc密码
sudo x11vnc -storepasswd /etc/x11vnc.pass
创建 /etc/systemd/system/x11vnc.service,并写入以下内容
sudo vim /etc/systemd/system/x11vnc.service
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth /run/user/1000/gdm/Xauthority -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target
启动x11vnc服务
sudo systemctl enable x11vnc
sudo service x11vnc start
安装XRDP
sudo apt install xrdp -y
重启系统
mstsc远程连接