ubuntu - 尽管可以在 Windows 上运行,但 Ubuntu 上的 X11 转发错误

标签 ubuntu ssh x11 x11-forwarding

我有一个有趣的问题 - 在 Windows 上使用 Xming 我可以成功地将 X11 请求转发到我的客户端 (PC) 并可以运行应用程序。然而,我最近在我的电脑上安装了 Ubuntu 13.04,但不知何故我无法让它工作。

我的/etc/ssh/ssh_config 有以下几行:

Host *
ForwardAgent yes
ForwardX11 yes

我尝试使用以下命令进行连接:

ssh -X -v <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5c292f392e323d31391c242424722424247224242472242424" rel="noreferrer noopener nofollow">[email protected]</a> 

详细输出显示:

X11 forwarding request failed on channel 0

我还执行了xhost +来禁用客户端上的所有访问控制,但奇怪的是在我的客户端上DISPLAY变量设置为:0 并且我无法将其替换为其他任何内容,例如 localhost:0 甚至 $Local_IP:0,当我这样做时,X11 将无法工作,请参阅示例下面的输出 - 我怀疑这可能会导致答案:

koray@koray-Latitude:~$ export DISPLAY=localhost:0 # $localip:0 doesn't work either
koray@koray-Latitude:~$ emacs
Display localhost:0 unavailable, simulating -nw
koray@koray-Latitude:~$

最佳答案

我解决了它 - 这是一个身份验证问题。在服务器上执行以下行解决了该问题:

$ xauth add ${client_ip}:0 . ${hex_key}
xauth:  creating new authority file /homes/${username}/.Xauthority

其中 ${client_ip} 是运行 X 服务器的客户端,${hex_key} 是 32 个字符的十六进制字符串。之后,在分配 $DISPLAY 环境变量后,我现在可以成功连接。

关于ubuntu - 尽管可以在 Windows 上运行,但 Ubuntu 上的 X11 转发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18061121/

相关文章:

linux - 如何更改目录颜色?

c - 无法编译包含问题的 C 代码

ubuntu - DocumentRoot 没有改变,从 Apache2 2.2.22 更新到 2.4.7

c - 如何以编程方式检索附加到 Xorg 屏幕的图形适配器和显示器名称?

c++ - X损坏 : get event on window content changes

node.js - 亚马逊 EC2 Ubuntu 实例 : Where should I upload the files to access them from the browser?

bash - 如何通过shh将mysql数据库从一个centos服务器上传到另一个centos服务器

linux - 当您从机器 C ssh 进入 ssh 隧道 B->A 时,私钥会发生什么变化?

ssh - 无法使用 knife ssh 访问我的 EC2 Chef 节点

linux - 如何将附加信息附加到像素图?