-
Ubuntu16.04安装 x11vnc远程桌面并设置开机自动启动
1.安装x11vnc
sudo apt-get install x11vnc
2.设置开机自动启动连接密码
sudo x11vnc -storepasswd
3.将密码储存在/etc/x11vnc.pass 下
sudo x11vnc -storepasswd in /etc/x11vnc.pass
4.在系统服务目录中新建服务文件
sudo vim /lib/systemd/system/x11vnc.service
5.在文件中添加下列代码
[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/<USERNAME>/.vnc/passwd -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target
注意代码中USERNAME,是你的用户名,切记一定要更改。
1.设置开机自启服务
sudo systemctl daemon-reload
sudo systemctl enable x11vnc.service
sudo systemctl start x11vnc.service
查看状态
systemctl status x11vnc.service
-
(Ubuntu)无显示器接入,使用虚拟显示器且远程控制
1.安装使 Ubuntu 使用虚拟显示器的软件
sudo apt-get install xserver-xorg-core-hwe-16.04
sudo apt-get install xserver-xorg-video-dummy-hwe-16.04 --fix-missing
2.修改/创建配置文件(默认就会使用虚拟显示器)
sudo vim /usr/share/X11/xorg.conf.d/xorg.conf
添加如下代码:
Section "Device"
Identifier "Configured Video Device"
Driver "dummy"
EndSection
Section "Monitor"
Identifier "Configured Monitor"
HorizSync 31.5-48.5
VertRefresh 50-70
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080"
EndSubSection
EndSection
重启就可以生效
重启之后即使接入了显示器,也不会输出信号到显示器上!
但是通过 VNC-Viewer 与在未按照本文安装软件和修改配置文件前一模一样可以链接到 Ubuntu 主机上,进行“远程”桌面控制