SecureCRT使用圖形程序故障(root用戶su登錄oracle用戶)

最近看一朋友機器上安裝Xmanager之後,用SecureCRT登錄後,在字符界面下就可以直接啓動圖形安裝程序,隨後自己嘗試安裝,卻出現問題,現將解決方法描述如下:

一、安裝了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’t for 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都正常了

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章