Install VNC Server(x11vnc)in ubuntu 16.04

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
Reference:
  1. https://help.ubuntu.com/community/VNC/Servers

  2. https://it.ismy.fun/2018/10/16/linux-mint-x11vnc/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章