SecureCRT使用图形程序故障

来源:互联网 发布:海森梅尔什么档次 知乎 编辑:程序博客网 时间:2024/05/16 08:08

1、 以root用户登录

输入命令xdpyinfo,记录下里面的name of display:后的字符串,如 name of display:127.0.0.1:1.0

在执行xhost +命令(使得所有客户都可以访问)

返回信息为:
access control disabled,clients can connect from any host

如果xhost +不能执行,可以输入命令export DISPLAY=:0执行一下

再执行xhost +

xhost + ip (name表示那个ip机器可以使用该服务)

2、以oracle用户登录

如果前面root登录下执行xdpyinfo后的name of display:后的字符串是127.0.0.1:1.0

那么在该oracle用户下执行一下export DISPLAY=:1.0

然后再执行xdpyinfo命令,如果能出现信息说明你已经成功了

这样估计就可以解决linux下安装oracle出现的xhost问题



虚拟机上测试成功


一、安装了Xmanager软件,在客户端上开启了Xmanager - Passive 程序

二、SecureCRT的会话选项中--端口转发--远程/X11--里将转发X11数据包勾上

root用户登录后运行xclock程序,能够正常弹出时钟界面。

随后切换到oracle用户

su - oracle

运行xclock,出错

Xlib: connection to "localhost:10.0" refused by server
Xlib: SSH gateway: X11 authentication failed.

返回root用户,运行xhost +(+中间有空格)

xhost +

access control disabled, clients can connect from any host

在次登录oracle用户,运行xclock,依然报错,像是没有权限,认证出错。

Xlib: connection to "localhost:10.0" refused by server
Xlib: SSH gateway: X11 authentication failed.

用baidu在网上寻找N篇文章,均未解决。

后在一英文网站上找到解决办法,文章如下:

 

Getting “Xlib: PuTTY X11 proxy: wrong authentication protocol attempted”? I have the answer :)

Here’s the scenario:

You ssh to a remote server with your login and either sudo or su to another user to run some application that uses a X Windows front end.  There is a firewall between your desktop and the remote server that allows only ssh connections (port 22).  When you run into the error “Xlib: PuTTY X11 proxy: wrong authentication protocol attempted”.  What to do?
ssh jason@remote-server -X
jason $ echo $DISPLAY
localhost:10.0
jason $ su – oracle
oracle‘s Password:
oracle $ xterm
Xlib: connection to "localhost:10.0" refused by server
Xlib: PuTTY X11 proxy: wrong authentication protocol attempted
xterm Xt error: Can’t open display: localhost:10.0

On recent OpenSSH Server releases, you can simply enable “ForwardX11Trusted yes” in the /etc/ssh/sshd_config file and restart the OpenSSH server.  If you’re not using a recent OpenSSH Server release or if you can’tfor security or political reasons, what could you do? Give up? It’s simpler than you think.
You need to temporarily transfer the authorization to the other account. First, get the key from your account:
jason $ xauth list
aspc2o1/unix:10 MIT-MAGIC-COOKIE-1 bc334c66cfec3c5c3d5b0efc4ee9d3ad

Next, sudo/su to the other account and add the authorization key.
jason $ su – oracle
oracle $ xauth add aspc2o1/unix:10 MIT-MAGIC-COOKIE-1 bc334c66cfec3c5c3d5b0efc4ee9d3ad

Now, you should be able to start any X Windows application, assuming that your DISPLAY variable is set to go through the ssh tunnel:
oracle $ xterm

 

按上述解决思路,先在root用户下
xauth list
test/unix:0  MIT-MAGIC-COOKIE-1  c9b6fb154e27f4502bb7a2567f80be94
test:0  MIT-MAGIC-COOKIE-1  c9b6fb154e27f4502bb7a2567f80be94
test/unix:10  MIT-MAGIC-COOKIE-1  e159d383446bb081235e5203910f343b
切换到oracle用户下
xauth list
test/unix:10  MIT-MAGIC-COOKIE-1  0b608e65c9794e764c5bc3bf8e6bf9a0
test/unix:11  MIT-MAGIC-COOKIE-1  783e33c44cdeaa491b3694539d556faf
发现test/unix:10后面的那串认证码和root下看到的不一样,修改一下
xauth add MIT-MAGIC-COOKIE-1  e159d383446bb081235e5203910f343b
之后在xauth list,发现一致了
test/unix:10  MIT-MAGIC-COOKIE-1  e159d383446bb081235e5203910f343b
test/unix:11  MIT-MAGIC-COOKIE-1  783e33c44cdeaa491b3694539d556faf
之后在运行xclock或dbca都正常了

 


原创粉丝点击