如何在CentOS中設置VNC多用戶登錄


 
1、安裝VNC軟件
yum install tigervnc tigervnc-server fontforge -y

 

2、配置多個用戶用戶下的vnc登錄密碼
#例如設置oracle用戶的vnc登錄密碼:

[oracle@oracle ~]$ id
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)
[oracle@oracle ~]$ vncpasswd 
Password:
Verify:

 

 

3.編輯vnc配置文件
[root@oracle ~]# more  /etc/sysconfig/vncservers 
# The VNCSERVERS variable is a list of display:user pairs.
#
…………(省略部分內容)
# `man vncviewer' manual page.

# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"

VNCSERVERS="1:root 2:oracle"
VNCSERVERSVNCSERVERARGS[1]="-geometry 1024x768 -alwaysshared"  
VNCSERVERSVNCSERVERARGS[2]="-geometry 1024x768 -alwaysshared"

注意:-geometry 1024x768表示分辨率;-alwaysshared 表示允許多終端同時登陸


 

4、打開對應的端口

打開5901至5902 端口用於vnc //如果需要配置更多的桌面,增加端口即可
iptables -I INPUT -p tcp --dport 5901:5902 -j ACCEPT
iptables -A INPUT -p tcp --dport 5901:5902 -j ACCEPT
永久保存
service iptables save


4.啟動vncserver服務
1)啟動全部桌面
service vncserver start
2)啟動某一桌面
vncserver :1 //這里1表示第一個桌面

5、停止vncserver服務

1)停止全部桌面
service vncserver stop
2) 停止某一桌面
vncserver -kill :1 //停止第1個界面,要用kill命令來殺掉界面1的進程

6、查看當前有幾個桌面在運行

service vncserver status

7、讓vncserver服務隨機啟動

默認狀態下,vncserver服務不是開機自動啟動,需要手工啟動。
chkconfig --list vncserver
chkconfig vncserver on
保存后,重啟測試。

8.客戶端登錄vncserver服務

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM