Chinaunix首页 | 论坛 | 博客
  • 博客访问: 227649
  • 博文数量: 36
  • 博客积分: 1137
  • 博客等级: 少尉
  • 技术积分: 305
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-06 09:58
文章分类

全部博文(36)

文章存档

2012年(1)

2011年(31)

2010年(3)

2007年(1)

分类: LINUX

2010-07-04 22:19:48

Redhatvnc server多用户连接失败

 

一:问题

1.1安装vncserver

yum install vncserver

1.2 修改/etc/sysconfig/vncservers

取消以下两行的注释

 

VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"

 

1.3设置访问密码及修改配置文件

执行 

修改$HOME/.vnc/xstartup,取消以下两行的注释

unset SESSION_MANAGER

exec /etc/X11/xinit/xinitrc

1.4 启动vncserver

/etc/init.d/vncserver restart

启动成功后,发现只有ip:1 能登录 ip:2登录不了。

 

二:分析

通过ps查看进程发现启动vnc display的参数不一样

[root@localhost ~]# ps -ef | grep vnc

root      8041     1  0 04:56 pts/4    00:00:01 Xvnc :1 -desktop localhost.localdomain:1 (root) -httpd /usr/share/vnc/classes -auth /root/.Xau                thority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -pn

oracle    8575     1  1 05:05 ?        00:00:00 Xvnc :2 -desktop localhost.localdomain:2 (oracle) -httpd /usr/share/vnc/classes -auth /home/or                acle/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /home/oracle/.vnc/passwd -rfbport 5902 –pn

 

查看/etc/init.d/vncserver 发现开启vncserver的语句是40行:

runuser -l ${USER} -c "cd ~${USER} && [ -f .vnc/passwd ] && vncserver :${DISP} ${VNCUSERARGS}"

 

${VNCUSERARGS}是启动的时候带的参数,问题应该就出在这。

 

三:解决办法

解决的方法有一下两种:

1 修改/etc/init.d/vncserver 找到40行修改为

runuser -l ${USER} -c "cd ~${USER} && [ -f .vnc/passwd ] && vncserver :${DISP}"

2、修改/etc/sysconfig/vncserver 注释掉下面这行

VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"

 

现在重启/etc/init.d/vncserver restart

现在执行ps 发现参数一直,也能使用另外的用户访问了。

[root@localhost ~]# ps -ef |grep vnc

root     10389     1  1 05:47 pts/1    00:00:02 Xvnc :1 -desktop localhost.localdomain:1 (root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -pn

oracle   10492     1  0 05:47 ?        00:00:01 Xvnc :2 -desktop localhost.localdomain:2 (oracle) -httpd /usr/share/vnc/classes -auth /home/oracle/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /home/oracle/.vnc/passwd -rfbport 5902 –pn

 

四:补遗

Vncserver的配置文件只设置了display2的参数

# 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.

也可以去掉-localhost参数,或者设置vncview


阅读(3934) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~