step5:修改当前用户下的.vnc目录下的xstartup文件
[@linuxidc ~]$ vi .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 & #注释行
gnome-session & #新增行,调用gnome桌面
同理切换到test用户,按tghfly用户一样设置
[@linuxidc ~]$ su - test
Password:
[test@hongwb ~]$ vncserver #生成认证文件
You will require a password to access your desktops.
Password:
Verify:
xauth: creating new authority file /home/test/.Xauthority
New 'hongwb.com.cn:2 (test)' desktop is hongwb.com.cn:2
Creating default startup script /home/test/.vnc/xstartup
Starting applications specified in /home/test/.vnc/xstartup
Log file is /home/test/.vnc/hongwb.com.cn:2.log
[test@hongwb ~]$ vi .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 &
gnome-session &
step6:到root用户下,重新启动vnc服务
[root@ ~]# service vncserver restart
Shutting down VNC server: 1:tghfly 2:test [ OK ]
Starting VNC server: 1:tghfly
New 'hongwb.com.cn:1 (tghfly)' desktop is hongwb.com.cn:1
Starting applications specified in /home/tghfly/.vnc/xstartup
Log file is /home/tghfly/.vnc/hongwb.com.cn:1.log
2:test
New 'hongwb.com.cn:2 (test)' desktop is hongwb.com.cn:2
Starting applications specified in /home/test/.vnc/xstartup
Log file is /home/test/.vnc/hongwb.com.cn:2.log
[ OK ]