xshell打开GUI程序失败

xshell中执行GUI程序时会自动运行Xmanager,并在客户端机器显示GUI程序的图形界面。但使用su - xiao切换用户后,执行GUI程序报错:Connection lost to X server `localhost:10.0';xshell直接登录用户xiao则能够正常显示。查看环境变量DISPLAY,两种情况下都是localhost:10.0。

 

新建文件 /root/.xauth/export,内容为用户名xiao,问题解决。

 

问题解析:

-------------------------

The message above is received when X application fails to connect to PC X server, Xmanager.

The common reasons that may cause connection failure to PC X server are the following:

1. PC X server is not installed: After installing Xmanager, set "Forward X11 connections to Xmanager"(Properties -> Tunneling -> X11 Forwarding).

2. When switched to a different user using su command, X11 authentication cookie cannot be accessed.

 

-------------------------

 

The authority is propagated. Once you switch user to root s broken and you must manually create the xauthority. This behaviour is controlled by pam_xauth, and apparently you can make it automatic for root to forward the xauth key to a user by creating a file /root/.xauth/export and adding the allowed users to it, see
http://www.kernel.org/pub/linux/libs...pam_xauth.html

 

参考:

http://www.netsarang.com/bbs/detail.html?id=xshell&num=151

你可能感兴趣的:(Linux)