1

我在 win8.1 笔记本电脑上使用 Bitvise SSH Client 6.23 连接到带有 Ubuntu 12.04 LTS 的服务器。使用Xming,开启X11Forwarding。

对于单终端,一切正常

Bitvise SSH Client 中有一个功能,我可以用一个 ssh 会话打开两个终端。当我登录term1时,我得到:

Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.8.0-29-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

New release '14.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Last login: Tue Mar  3 23:38:09 2015 from 192.168.1.111
wei@wei-H8QG6:~$ env|grep -i ssh
SSH_CLIENT=192.168.1.111 64815 22
SSH_TTY=/dev/pts/3
SSH_CONNECTION=192.168.1.111 64815 192.168.1.130 22
wei@wei-H8QG6:~$ env|grep -i disp
DISPLAY=localhost:10.0
wei@wei-H8QG6:~$ xeyes
^C
wei@wei-H8QG6:~$

效果很好,然后我打开了另一个终端:term2:

Last login: Wed Mar  4 00:00:41 2015 from 192.168.1.111
wei@wei-H8QG6:~$ env|grep -i ssh
SSH_CLIENT=192.168.1.111 64815 22
SSH_TTY=/dev/pts/4
SSH_CONNECTION=192.168.1.111 64815 192.168.1.130 22
wei@wei-H8QG6:~$ env|grep -i disp
DISPLAY=localhost:11.0
wei@wei-H8QG6:~$ xeyes
Incorrect authorization cookie.
^C
wei@wei-H8QG6:~$

没有眼睛出来,这里是Bitvise SSH Client的日志

23:58:47.185 Bitvise SSH Client 6.23, a fully featured SSH2 client.
Copyright (C) 2000-2015 by Bitvise Limited.
23:58:47.185 Visit www.bitvise.com for latest information about our SSH2 products.
23:58:47.185 Run 'BvSsh -help' to learn the supported command-line parameters.
23:58:47.786 Loading last used profile 'D:\User\MyDoc\wei.bscp'.
23:58:47.789 Last used profile loaded successfully.
23:58:52.401 Started a new SSH2 session.
23:58:52.409 Connecting to SSH2 server 192.168.1.130:22.
23:58:52.409 Connection established.
23:58:52.420 Server version: SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1
23:58:52.428 First key exchange started.
23:58:52.526 Received a new host key from the server. Algorithm: ECDSA/nistp256, size: 256 bits, MD5 fingerprint: ee:67:a3:77:4d:3b:5e:d4:60:51:0e:e3:ef:2c:00:5a, Bubble-Babble: xicoc-hilor-gugyc-bavar-vaget-nysys-kuvip-kosov-bykaf-dohor-suxax.
23:58:52.557 First key exchange completed using ecdh-sha2/nistp521. Session encryption: aes256-ctr, MAC: hmac-sha2-256, compression: none.
23:58:52.564 Attempting password authentication.
23:58:57.700 Authentication completed.
23:59:08.868 Enabled X11 forwarding to 127.0.0.1:6000.
23:59:08.875 Terminal channel opened.
23:59:08.875 Terminal channel: X11 forwarding accepted.
23:59:12.211 Terminal channel opened.
23:59:12.221 Terminal channel: X11 forwarding accepted.
23:59:55.778 Opened channel for X11 forwarding from 127.0.0.1:50442 to 127.0.0.1:6000.
00:00:01.138 Opened channel for X11 forwarding from 127.0.0.1:53486 to 127.0.0.1:6000.
00:00:01.146 X11 authentication failed forX11 forwarding from 127.0.0.1:53486 to 127.0.0.1:6000.
00:00:01.147 Closed channel for X11 forwarding from 127.0.0.1:53486 to 127.0.0.1:6000. Bytes sent: 40, received: 48.
00:00:08.779 Closed channel for X11 forwarding from 127.0.0.1:50442 to 127.0.0.1:6000. Bytes sent: 4308, received: 4820.

我尝试关闭term1,在term2 中X11 转发仍然不起作用。我还尝试关闭 term1 和 term2,并打开 term3。xeyes 失败: term3:

Last login: Wed Mar  4 00:07:56 2015 from 192.168.1.111
wei@wei-H8QG6:~$ xeyes
Incorrect authorization cookie.Incorrect authorization cookie.Incorrect authorization cookie.Incorrect authorization cookie.Error: Can't open display: localhost:10.0
wei@wei-H8QG6:~$

X11Forwarding 似乎只在建立 SSH 会话后打开的第一个终端上有效。之后,X11Forwarding 在任何终端都不起作用。我只能重新连接 SSH 会话以使其再次工作。

然后我尝试创建两个 SSH 会话。xeyes 适用于 SSH 会话的第一个终端,但对于其他终端则失败。

我不确定问题出在哪里,Xming X-server、Ubuntu 的 sshd 还是 Bitvise SSH 客户端?

4

1 回答 1

0

我找到了一些解决方法,但它们都不是一个合适的解决方案。在问题得到解决之前,最后一个选项可能是最简单的。

  • 启动第二个 SSH 客户端(您已经在问题中提到了此选项)。
  • 从第一个终端导出cookie并在第二个终端中导入: 1. 在终端一中,找到显示编号echo $DISPLAY并记下:10.0位,然后xauth list :10.0。2. 在第二个终端 ( xauth add <copy-pasted-xauth>) 中添加 cookie。
  • 更改终端 2 中的显示端口以匹配终端 1。所以在终端一你会做echo $DISPLAY,在终端二setenv DISPLAY <copy-pasted-display>

我不是 linux 专家,不知道更改 的值DISPLAY是否可以接受,但它似乎可以解决问题。

于 2015-10-09T09:31:40.510 回答