Zorin OS 15 Lite RealVNC多用户部署
source link: https://apad.pro/ubuntu-xfce-realvnc/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Zorin OS 15 Lite RealVNC多用户部署
Zorin OS 15 Lite是基于Ubuntu 18.04的XFCE桌面版本,桌面接近Windows占用资源较少,使用RealVNC服务端还可以双向传输文件
部署好操作系统后,假设管理员用户名为user,建议先在界面创建多个需要的用户,例如 user1、user2 … user5
授予用户root权限
sudo vim /etc/sudoers #在 root ALL=(ALL:ALL) ALL 下方添加 user1 ALL=(ALL:ALL) ALL user2 ALL=(ALL:ALL) ALL user3 ALL=(ALL:ALL) ALL user4 ALL=(ALL:ALL) ALL user5 ALL=(ALL:ALL) ALL
- sudo vim /etc/sudoers
- #在 root ALL=(ALL:ALL) ALL 下方添加
- user1 ALL=(ALL:ALL) ALL
- user2 ALL=(ALL:ALL) ALL
- user3 ALL=(ALL:ALL) ALL
- user4 ALL=(ALL:ALL) ALL
- user5 ALL=(ALL:ALL) ALL
sudo vim /etc/sudoers #在 root ALL=(ALL:ALL) ALL 下方添加 user1 ALL=(ALL:ALL) ALL user2 ALL=(ALL:ALL) ALL user3 ALL=(ALL:ALL) ALL user4 ALL=(ALL:ALL) ALL user5 ALL=(ALL:ALL) ALL
下载RealVNC服务端
wget https://www.realvnc.com/download/file/vnc.files/VNC-Server-6.8.0-Linux-x64.deb
- wget https://www.realvnc.com/download/file/vnc.files/VNC-Server-6.8.0-Linux-x64.deb
wget https://www.realvnc.com/download/file/vnc.files/VNC-Server-6.8.0-Linux-x64.deb
安装RealVNC服务端
sudo dpkg -i VNC-Server-6.8.0-Linux-x64.deb sudo vnclicense -add HN264-DB23A-XGLEB-BQCQN-T47AA
- sudo dpkg -i VNC-Server-6.8.0-Linux-x64.deb
- sudo vnclicense -add HN264-DB23A-XGLEB-BQCQN-T47AA
sudo dpkg -i VNC-Server-6.8.0-Linux-x64.deb sudo vnclicense -add HN264-DB23A-XGLEB-BQCQN-T47AA
配置桌面环境
sudo vim /etc/vnc/xstartup.custom #输入以下内容 #!/bin/sh DESKTOP_SESSION=xfce export DESKTOP_SESSION startxfce4 vncserver-virtual -kill $DISPLAY
- sudo vim /etc/vnc/xstartup.custom
- #输入以下内容
- #!/bin/sh
- DESKTOP_SESSION=xfce
- export DESKTOP_SESSION
- startxfce4
- vncserver-virtual -kill $DISPLAY
sudo vim /etc/vnc/xstartup.custom #输入以下内容 #!/bin/sh DESKTOP_SESSION=xfce export DESKTOP_SESSION startxfce4 vncserver-virtual -kill $DISPLAY
赋予xstartup.custom执行权限
sudo chmod +x /etc/vnc/xstartup.custom
- sudo chmod +x /etc/vnc/xstartup.custom
sudo chmod +x /etc/vnc/xstartup.custom
创建VNC多用户启动脚本
sudo vim /etc/vnc/startvnc.sh #输入以下内容 #!/bin/bash su - user1 -c "sudo -u user1 vncserver-virtual -geometry 1920x1080 :1" su - user2 -c "sudo -u user2 vncserver-virtual -geometry 1920x1080 :2" su - user3 -c "sudo -u user3 vncserver-virtual -geometry 1920x1080 :3" su - user4 -c "sudo -u user4 vncserver-virtual -geometry 1920x1080 :4" su - user5 -c "sudo -u user5 vncserver-virtual -geometry 1920x1080 :5" exit 0
- sudo vim /etc/vnc/startvnc.sh
- #输入以下内容
- #!/bin/bash
- su - user1 -c "sudo -u user1 vncserver-virtual -geometry 1920x1080 :1"
- su - user2 -c "sudo -u user2 vncserver-virtual -geometry 1920x1080 :2"
- su - user3 -c "sudo -u user3 vncserver-virtual -geometry 1920x1080 :3"
- su - user4 -c "sudo -u user4 vncserver-virtual -geometry 1920x1080 :4"
- su - user5 -c "sudo -u user5 vncserver-virtual -geometry 1920x1080 :5"
- exit 0
sudo vim /etc/vnc/startvnc.sh #输入以下内容 #!/bin/bash su - user1 -c "sudo -u user1 vncserver-virtual -geometry 1920x1080 :1" su - user2 -c "sudo -u user2 vncserver-virtual -geometry 1920x1080 :2" su - user3 -c "sudo -u user3 vncserver-virtual -geometry 1920x1080 :3" su - user4 -c "sudo -u user4 vncserver-virtual -geometry 1920x1080 :4" su - user5 -c "sudo -u user5 vncserver-virtual -geometry 1920x1080 :5" exit 0
创建VNC停止脚本
sudo vim /etc/vnc/stopvnc.sh #输入以下内容 #!/bin/bash su - user1 -c "sudo -u user1 vncserver-virtual -kill :1" su - user2 -c "sudo -u user2 vncserver-virtual -kill :2" su - user3 -c "sudo -u user3 vncserver-virtual -kill :3" su - user4 -c "sudo -u user4 vncserver-virtual -kill :4" su - user5 -c "sudo -u user5 vncserver-virtual -kill :5"
- sudo vim /etc/vnc/stopvnc.sh
- #输入以下内容
- #!/bin/bash
- su - user1 -c "sudo -u user1 vncserver-virtual -kill :1"
- su - user2 -c "sudo -u user2 vncserver-virtual -kill :2"
- su - user3 -c "sudo -u user3 vncserver-virtual -kill :3"
- su - user4 -c "sudo -u user4 vncserver-virtual -kill :4"
- su - user5 -c "sudo -u user5 vncserver-virtual -kill :5"
sudo vim /etc/vnc/stopvnc.sh #输入以下内容 #!/bin/bash su - user1 -c "sudo -u user1 vncserver-virtual -kill :1" su - user2 -c "sudo -u user2 vncserver-virtual -kill :2" su - user3 -c "sudo -u user3 vncserver-virtual -kill :3" su - user4 -c "sudo -u user4 vncserver-virtual -kill :4" su - user5 -c "sudo -u user5 vncserver-virtual -kill :5"
赋予脚本执行权限
sudo chmod +x /etc/vnc/startvnc.sh sudo chmod +x /etc/vnc/stopvnc.sh
- sudo chmod +x /etc/vnc/startvnc.sh
- sudo chmod +x /etc/vnc/stopvnc.sh
sudo chmod +x /etc/vnc/startvnc.sh sudo chmod +x /etc/vnc/stopvnc.sh
修改系统rc.local服务
sudo vim /etc/systemd/system/rc-local.service #添加以下内容 [Unit] Description=/etc/rc.local Compatibility ConditionPathExists=/etc/rc.local [Service] Type=forking ExecStart=/etc/rc.local start TimeoutSec=0 StandardOutput=tty RemainAfterExit=yes SysVStartPriority=99 [Install] WantedBy=multi-user.target
- sudo vim /etc/systemd/system/rc-local.service
- #添加以下内容
- [Unit]
- Description=/etc/rc.local Compatibility
- ConditionPathExists=/etc/rc.local
- [Service]
- Type=forking
- ExecStart=/etc/rc.local start
- TimeoutSec=0
- StandardOutput=tty
- RemainAfterExit=yes
- SysVStartPriority=99
- [Install]
- WantedBy=multi-user.target
sudo vim /etc/systemd/system/rc-local.service #添加以下内容 [Unit] Description=/etc/rc.local Compatibility ConditionPathExists=/etc/rc.local [Service] Type=forking ExecStart=/etc/rc.local start TimeoutSec=0 StandardOutput=tty RemainAfterExit=yes SysVStartPriority=99 [Install] WantedBy=multi-user.target
创建VNC自启动脚本
sudo vim /etc/rc.local #添加以下内容 #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. /etc/vnc/startvnc.sh exit 0
- sudo vim /etc/rc.local
- #添加以下内容
- #!/bin/sh -e
- # rc.local
- # This script is executed at the end of each multiuser runlevel.
- # Make sure that the script will "exit 0" on success or any other
- # value on error.
- # In order to enable or disable this script just change the execution
- # bits.
- # By default this script does nothing.
- /etc/vnc/startvnc.sh
- exit 0
sudo vim /etc/rc.local #添加以下内容 #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. /etc/vnc/startvnc.sh exit 0
给rc.local加上权限
sudo chmod +x /etc/rc.local
- sudo chmod +x /etc/rc.local
sudo chmod +x /etc/rc.local
启动系统rc.local服务
sudo systemctl start rc-local.service sudo systemctl enable rc-local.service
- sudo systemctl start rc-local.service
- sudo systemctl enable rc-local.service
sudo systemctl start rc-local.service sudo systemctl enable rc-local.service
最后去RealVNC官网下载客户端,输入ip:port即可连接VNC,端口号从5901开始顺序排列,示例中的user5则是5905端口,如无法访问请开放防火墙的对应端口
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK