The Vino server is only available after you have logged in to system locally.
x11vnc is a VNC server that is not dependent on any one particular graphical environment.
1.Remove the default Vino server:
$ sudo apt-get -y remove vino
2.Install x11vnc:
$ sudo apt-get -y install x11vnc
3.Create the directory for the password file:
$ x11vnc -storepasswd
It will respond with:
Enter VNC password:
Verify password:
Write password to /home/USERNAME/.vnc/passwd? [y]/n y
Password written to: /home/USERNAME/.vnc/passwd
One may execute the following in a terminal:
$ x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/USERNAME/.vnc/passwd -rfbport 5900 -shared -capslock -nomodtweak
Here a few settings that would be common to adjust depending on your environment:
- To set x11vnc to request access each time when set without a password, include the -nopw -accept popup:0 options.
- To set x11vnc to only listen for the next connection, include the -once option.
- To set x11vnc to continually listen for connections, include the -forever option.
- To put x11vnc in view-only mode, include the -viewonly option.
- To set x11vnc to only allow local connections, include the -localhost option.
ps:之前遇到了用vnc-viewer连接,键盘Caps Lock和小键盘错位的问题,加上选项
-capslock -nomodtweak就好了。
4.Create the systemd service file for the x11vnc service:【Have x11vnc start automatically via systemd in any environment (Vivid+)】
$ sudo nano /lib/systemd/system/x11vnc.service
Copy/Paste this code into the empty file:
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -noxdamage -repeat -rfbauth /home/USERNAME/.vnc/passwd -rfbport 5900 -shared -capslock -nomodtweak
[Install]
WantedBy=multi-user.target
5.Reload the services:
$ sudo systemctl daemon-reload
6.Enable the x11vnc service at boot time:
$ sudo systemctl enable x11vnc.service
7.Start the service:
Either reboot or
$ sudo systemctl start x11vnc.service