6月25
有时候我们需要不同的用户同时用VNC来登陆系统。
单独安装了VNC,是不允许用户登陆的,今天我们说明一下VNC多用户登陆的设置。
一、先安装vncserver,并将vncserver设为自启动:
[root@CentOS ~]#chkconfig --level 345 vncserver on
二、修改配置文件,设置可通过VNC客户端登陆的用户:
[root@CentOS ~]#vi /etc/sysconfig/vncservers
修改vnc配置文件为:
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
# <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
# Use "-nohttpd" to prevent web-based VNC clients connecting.
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.
# VNCSERVERS="2:myusername"
VNCSERVERS="1:root 2:test 3:zhxd"
VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[2]="-geometry 800x600"
VNCSERVERARGS[3]="-geometry 800x600"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
# <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
# Use "-nohttpd" to prevent web-based VNC clients connecting.
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.
# VNCSERVERS="2:myusername"
VNCSERVERS="1:root 2:test 3:zhxd"
VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[2]="-geometry 800x600"
VNCSERVERARGS[3]="-geometry 800x600"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
说明:VNCSERVERS为可通过VNC客户端远程登陆的用户
格式为:1:用户1 2:用户2 3:用户3
但这样做了,仅仅用户1才能登陆,用户2、用户3是无法登陆的。
三、修改配置文件,允许多用户登陆
[root@CentOS ~]#su - test
[test@CentOS ~]$mkdir .vnc //*创建.vnc目录,用于保存此用户的vnc配置文件*//
[test@CentOS ~]$vncpasswd //*设置test用户的vnc远程连接密码*//
[test@CentOS ~]$su - root
[root@CentOS ~]#service vncserver restart
[test@CentOS ~]$mkdir .vnc //*创建.vnc目录,用于保存此用户的vnc配置文件*//
[test@CentOS ~]$vncpasswd //*设置test用户的vnc远程连接密码*//
[test@CentOS ~]$su - root
[root@CentOS ~]#service vncserver restart
四、修改用户的GUI界面
默认vnc登陆,系统默认的都是twm,怎样使用kde或Gnome呢?
首先保证系统中已经安装了kde或Gnome,然后分别修改用户的$HOME/.vnc/xstartup为:
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#xsetroot -solid grey
#vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
startkde &(如果安装的是Gnome,则此行修改为gnome-session &)
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#xsetroot -solid grey
#vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
startkde &(如果安装的是Gnome,则此行修改为gnome-session &)
(即将倒数第一行至第四行注释掉,再在末行添加要启用的gui界面)
fsck.ext3:Un
VNC多用户登陆黑屏问题



