sudo apt update && \
sudo apt upgrade -y && \
sudo apt install -y libturbojpeg \
vino && \
sudo ln -s ../vino-server.service /usr/lib/systemd/user/graphical-session.target.wants && \
gsettings set org.gnome.Vino prompt-enabled false && \
gsettings set org.gnome.Vino require-encryption false
打开文件
sudo vim /usr/share/glib-2.0/schemas/org.gnome.Vino.gschema.xml
将以下内容写入文件同级部分
<key name='enabled' type='b'>
<summary>Enable remote access to the desktop</summary>
<description>
If true, allows remote access to the desktop via the RFB protocol.Users on remote machines may then connect to the desktop using a VNC viewer.
</description>
<default>false</default>
</key>
设置为Gnome编译模式
sudo glib-compile-schemas /usr/share/glib-2.0/schemas
桌面共享设置:
1.勾选"Allow other users to view your desktop".
2.勾选"Allow other users to control your desktop".
3.勾选"Require the user to enter this password:“,并且输入密码,该密码用来远程控制.
4.勾选"Automatically configure UPnP router to open and forward ports”.
5.勾选"Always".
开机启动VNC配置
vim ~/openvino.sh
写入以下内容
#!/bin/bash
export DISPLAY=:0
gsettings set org.gnome.Vino enabled true
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino require-encryption false
xrandr --fb 1920x1080
/usr/lib/vino/vino-server &
赋予权限
chmod 755 ~/openvino.sh
最后在开机启动中加入该文件,其他电脑即可使用vnc控制.
PS:如果设置以上内容后,远程分辨率不是设置的1920x1080,可执行以下操作:
打开文件
sudo gedit /etc/X11/xorg.conf
在最后添加以下内容:
Section "Screen"
Identifier "Default Screen"
SubSection "Display"
Virtual 1920 1080
EndSubSection
EndSection
保存文件后重启
reboot