Vnc 在大部分时候,是需要多个用户都登陆同一台服务器.每个登陆用户都有自己
独立 的桌面,这些桌面互相之间不影响. 就是说你用你的用户登陆的桌面,是不
会对我的用户登陆的桌面有任何改变的.
所以,我们一般不是去修改/etc/sysconfig/vncserver 这个文件,也不需要启动
vncserver 这个服务.那么,我们到底是如何做呢?
Vnc 默认的桌面管理工具是TWM,是一个比较丑陋的桌面,所以我们一般都不会
用他.
目前我推荐使用xfce.
1. 以普通用户使用ssh secure shell 登陆,比如wgh
[wgh@sw0 ~]$ id
uid=3025(wgh) gid=3000(sw) groups=3000(sw)
[wgh@sw0 ~]$ vncserver
You will require a password to access your desktops.
Password:
Verify:
#此处一定记住,不要用右边的数字小键盘输入密码,vnc 不使用它们.
New 'sw0:29 (wgh)' desktop is sw0:29
Creating default startup script /sw/wgh/.vnc/xstartup
Starting applications specified in /sw/wgh/.vnc/xstartup
Log file is /sw/wgh/.vnc/sw0:29.log
[wgh@sw0 ~]$
2. 修改默认的桌面管理程序
$vi ~/.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 &
startxfce4 &
主要是最后红色部分,前面都 一样.
3. 再次启动vncserver
$vncserver
New 'sw0:29 (wgh)' desktop is sw0:29
Starting applications specified in /sw/wgh/.vnc/xstartup
Log file is /sw/wgh/.vnc/sw0:29.log
这样,我的桌面就是29 号桌面.
4. 使用vncviewer
填写地址:
10.10.25.21:29
然后会问你密码,输入前 面设置的密码,就是你个人的vnc 桌面了
其他用 户照办!
但是遇到一个问题:他root 可以,其他用户不行。啥都找遍了,就是不知道为
何。
比较bt 的事情是他只能看到了告诉我,结果很多事情传一遍,可能跟我想的就
不一样 了。
最后,我让他给我看了日志。发现问题所在了。
他的xstartup 文件还需要
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
gnome-session &