如何使用 PuTTY 和 Xming 在 Windows 上使用 X11 转发?

Nob*_*ift 20 gnome xorg putty x-windows

我一直想让 X11 Forwarding 与 PuTTY 一​​起工作,而我使用的 X Window 系统是 Xming。当我运行 Xming 并与我的服务器建立新连接时,我在命令后收到以下信息:

$ firefox
PuTTY X11 proxy: wrong authentication protocol attemptedPuTTY X11 proxy: wrong authentication protocol attemptedError: cannot open display: localhost:10.168

$ google-chrome
PuTTY X11 proxy: wrong authentication protocol attempted
(google-chrome:7083): Gtk-WARNING **: cannot open display: localhost:10.168

$ gedit
PuTTY X11 proxy: wrong authentication protocol attempted
** (gedit:6990): WARNING **: Could not open X display
PuTTY X11 proxy: wrong authentication protocol attemptedCannot open display:
Run 'gedit --help' to see a full list of available command line options.

$ gnome-system-monitor
PuTTY X11 proxy: wrong authentication protocol attempted
** (gnome-system-monitor:7024): WARNING **: Could not open X display
PuTTY X11 proxy: wrong authentication protocol attempted
(gnome-system-monitor:7024): Gtk-WARNING **: cannot open display: localhost:10.168
Run Code Online (Sandbox Code Playgroud)

如何修复这些错误并使 X11 转发作为一个整体工作?

sib*_*baz 17

我有 2 个问题,发现这个问题与我的问题最接近,所以我认为我的解决方案对其他人有帮助,试图解决与我相同的问题。我的系统有 Cygwin/X (xinit 1.3.4-5) 和 PuTTY (0.64)。我设法通过在本地 startxbin 上设置 --listen tcp 并将到 .Xauthority 的路径传递给 putty 来深入了解它。

首先参考“PuTTY X11代理:无法连接到转发的X服务器:网络错误:连接被拒绝”错误,需要让X会话监听连接:打开cygwin终端,编辑/usr/bin/startxwin找到线...

defaultserverargs="-multiwindow"
Run Code Online (Sandbox Code Playgroud)

并将其更改为...

defaultserverargs="-multiwindow -listen tcp"
Run Code Online (Sandbox Code Playgroud)

其次,为了响应“需要授权,但未指定授权协议”错误,您需要让 putty 使用正确的 xauth 令牌(putty 内部似乎发生了一些奇怪的事情,因此xauth list本地没有提供转发连接可以使用的令牌)通过传入它们xauth add <token>,它们似乎需要在连接时由 PuTTY 设置,以便它们工作)。
通过运行(再次在 cygwin 终端中)在 windows 域中找到您的 ~/.Xauthority 文件所在的路径

cd ~
explorer .
Run Code Online (Sandbox Code Playgroud)

检查 .Xauthority 文件上的属性并记下它​​的位置(选择它并按 CTRL+C 将其放入剪贴板)。

按照上面的示例启动 PuTTY(从http://www.math.umn.edu/systems_guide/putty_xwin32.html复制)

在“控制 SSH X11 转发的选项”页面上,您应该选中“启用 X11 转发”,并将“MIT-Magic-Cookie-1”设置为协议。
在“用于本地显示的 X 权限文件”字段下,单击浏览并使用您之前记下的 .Xauthority 文件的位置,找到 .Xauthority 文件。单击打开以填充该字段,然后返回会话(在 PuTTY 配置中)并保存会话。然后就可以点击打开了。

它现在应该允许您连接。

  • 我还需要将“本地显示的 X 权限文件”设置为指向我的“cygwin”主目录中的“.Xauthority”文件夹。谢谢! (3认同)

Kru*_*uug 12

复制自:http : //www.math.umn.edu/systems_guide/putty_xwin32.html

配置腻子

  • 添加 Unix 主机名
  • 将协议切换到 SSH
  • 在保存的会话中键入会话名称
  • 点击“保存”

<img src='putty_xwin32/default_putty_rev-sm.png'/>

  • 从“类别”列表中展开“SSH”选项卡
  • 从“SSH”列表中选择“X11”
  • 选中“启用 X11 转发”

<img src='putty_xwin32/xfwd_putty_rev-sm.png'/>

  • 从“类别”列表中选择“会话”
  • 点击“保存”

在 Windows 上启动 X 服务器

配置 Xming

只需运行“所有程序 > Xming Xming”,如果您配置了 PuTTY,它应该可以工作。

连接

  • 启动Xming
  • 启动腻子
  • 双击您想要的已保存会话

<img src='putty_xwin32/session_putty_rev-sm.png'/>

  • 按要求输入用户名和密码
  • 您现在应该能够从本地桌面上的主机运行 X 应用程序

编辑:要修复wrong authentication protocol attempted错误,请尝试在 /etc/ssh/sshd_config 文件中启用“ForwardX11Trusted yes”,然后重新启动 OpenSSH 服务器。

  • `ForwardX11Trusted` 我们是客户端设置。将其放入`sshd_config` 充其量不会产生任何影响,并且会阻止 SSH 服务器在最坏的情况下启动。-1. 如果您正在寻找“手册”页面,则这是“sshd_config”与“ssh_config”。 (8认同)