快速部署远程vnc桌面 -docker部署
快速部署多用户独立桌面的远程vnc桌面 -docker部署
- 远程桌面与浏览器配置
- 1 启动远程桌面 服务器
- 2 添加apt-get 软件 安装源aliyun more /etc/apt/sources.list.d/aliyun.list
- 3 更新软件源 apt-get update
- 4 添加系统用户
- 5 添加vnc远程用户密码
- 6 配置远程用户及默认端口
- 7 多用户各自独立桌面启动
- 批量创建用户 useradd -m cnhz1
- 批量配置vncpasswd
远程桌面与浏览器配置
多用户各自独立桌面的vnc配置,需要配置如下:
1)启动服务器,配置服务器。
1)添加远程登录用户,
2)给每个用户提供一个vncserver 监听端口
1 启动远程桌面 服务器
## docker run --name ubuntu3 -d -p "35901-35911:5901-5911" -p "36901:6901" -e "VNC_PW=123456" --user 2000:3000 hub.rat.dev/accetto/ubuntu-vnc-xfce-firefox-g3-hz
2 添加apt-get 软件 安装源aliyun more /etc/apt/sources.list.d/aliyun.list
root@ccf1871a5f01:~# more /etc/apt/sources.list.d/aliyun.listdeb https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiversedeb https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiversedeb https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse# deb https://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiversedeb https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverseroot@ccf1871a5f01:~# apt-get update
3 更新软件源 apt-get update
root@ccf1871a5f01:~# apt-get update
root@ccf1871a5f01:~# apt-get install vim
4 添加系统用户
添加 多用户 cnhz1 到 cnhz10
root@ccf1871a5f01:~# useradd -m cnhz1root@ccf1871a5f01:~# passwd cnhz1
5 添加vnc远程用户密码
多用户 cnhz1 到 cnhz10
普通用户 执行
cnhz1@ccf1871a5f01:~$ vncpasswd cnhz1
Password:
Verify:
Would you like to enter a view-only password (y/n)? y
Password:
Verify:
6 配置远程用户及默认端口
多用户 cnhz1 到 cnhz10
root@ccf1871a5f01:~# vi /etc/tigervnc/vncserver.users
root@ccf1871a5f01:~# more /etc/tigervnc/vncserver.users
# TigerVNC user assignment
#
# This file assigns users to specific VNC display numbers.
# The syntax is <display>=<username>. E.g.:
#:2=cnhz2
:3=cnhz3:12=andrew
:13=lisa
7 多用户各自独立桌面启动
root@ccf1871a5f01:~# more vncserver.sh
# nohup sudo -u test1 vncserver :4 -geometry 1920x1080 -depth 24 &
nohup sudo -u cnhz1 vncserver :1 &
nohup sudo -u cnhz2 vncserver :2 &
nohup sudo -u cnhz3 vncserver :3 &
nohup sudo -u cnhz4 vncserver :4 &
nohup sudo -u cnhz5 vncserver :5 &
nohup sudo -u cnhz6 vncserver :6 &
nohup sudo -u cnhz7 vncserver :7 &
nohup sudo -u cnhz8 vncserver :8 &
nohup sudo -u cnhz9 vncserver :9 &nohup sudo -u cnhz10 vncserver :10 &
nohup sudo -u cnhz11 vncserver :11 &root@ccf1871a5f01:~# ./vncserver.sh
更新版本脚本:
root@ccf1871a5f01:~# more vncserver.sh
# nohup sudo -u test1 vncserver :4 -geometry 1920x1080 -depth 24 &
# nohup sudo -u cnhz1 vncserver :1 > nohup_cnhz1.log 2>&1 &
nohup sudo -u cnhz2 vncserver :2 > nohup_cnhz2.log 2>&1 &
nohup sudo -u cnhz3 vncserver :3 > nohup_cnhz3.log 2>&1 &
nohup sudo -u cnhz4 vncserver :4 > nohup_cnhz4.log 2>&1 &
nohup sudo -u cnhz5 vncserver :5 > nohup_cnhz5.log 2>&1 &
nohup sudo -u cnhz6 vncserver :6 > nohup_cnhz6.log 2>&1 &
nohup sudo -u cnhz7 vncserver :7 > nohup_cnhz7.log 2>&1 &
nohup sudo -u cnhz8 vncserver :8 > nohup_cnhz8.log 2>&1 &
nohup sudo -u cnhz9 vncserver :9 > nohup_cnhz9.log 2>&1 &nohup sudo -u cnhz10 vncserver :10 > nohup_cnhz10.log 2>&1 &
nohup sudo -u cnhz11 vncserver :11 > nohup_cnhz1.log 2>&1 &
root@ccf1871a5f01:~#
批量创建用户 useradd -m cnhz1
批量配置vncpasswd
使用该用户登录, cnhz3登录, 运行vncpasswd
cnhz3@ccf1871a5f01:~# vncpasswd
特别注意一定需要创建 此用户目录下的 vncpasswd 文件
