15

从 Fedora 23 到 Centos 7 建立 ssh 连接时,我遇到了一个不幸的问题。命令ssh -X user@centos7ssh -Y user@centos7两者都打印警告:没有 xauth 数据;使用伪造的身份验证数据进行 X11 转发。

谷歌搜索显示将以下行添加到 /etc/ssh/ssh_config:

Host *
    ForwardX11Trusted yes
    ForwardAgend yes
    ForwardX11 yes

但这并没有使警告信息消失。

4

4 回答 4

21

对我来说,这个问题是由我的 Fedora 系统没有~/.Xauthority文件引起的。

我通过在我的 Fedora 系统(客户端机器)上执行以下命令创建了一个:

xauth add :0 . `mcookie`
于 2017-05-21T18:09:14.973 回答
10

让 Windows 10 上的 Ubuntu bash 运行ssh -X 以在远程服务器上获得 GUI 环境

  • 第一的

安装以下所有内容。在 Windows 上,安装 X 服务器,例如Xming. 在 Ubuntu bash 上,用于sudo apt install安装ssh xauth xorg.

sudo apt install ssh xauth xorg
  • 第二

转到包含ssh_config文件的文件夹,我的是/etc/ssh.

  • 第三

以管理员身份编辑ssh_config(使用sudo)。在里面,删除行, ,ssh_config中的哈希,并将相应的参数设置为。#ForwardAgentForwardX11ForwardX11Trustedyes

# /etc/ssh/ssh_config

Host *
    ForwardAgent yes
    ForwardX11 yes
    ForwardX11Trusted yes
  • 第四

在file中,去掉and之前ssh_config的前面的hash ,并在文件末尾追加一个新行来说明xauth文件的位置,记得写下你自己的xauth文件路径。#Port 22Protocol 2XauthLocation /usr/bin/xauth

# /etc/ssh/ssh_config

#   IdentifyFile ...
    Port 22
    Protocol 2
#   Cipher 3des
#   ...
#   ...
    ...
    ...
    GSSAPIDelegateCredentials no
    XauthLocation /usr/bin/xauth
  • 第五

现在,既然我们已经完成了ssh_config文件的编辑,请在离开编辑器时保存它。现在转到文件夹~$HOME,附加export DISPLAY=localhost:0到您的.bashrc文件并保存。

# ~/.bashrc
...
...
export DISPLAY=localhost:0
  • 最后的

我们快完成了。重新启动 bash shell,打开Xming程序并使用ssh -X yourusername@yourhost. 然后享受 GUI 环境。

ssh -X yourusername@yourhost

问题也在 Windows 上的 Ubuntu 子系统中,链接位于

https://gist.github.com/DestinyOne/f236f71b9cdecd349507dfe90ebae776

于 2017-09-22T04:36:58.603 回答
7

请参阅https://serverfault.com/a/859370/423488

您可能必须/etc/ssh/ssh_config在客户端系统中添加这样的一行:

XAuthLocation /opt/X11/bin/xauth

但是使用客户端系统上程序的实际路径xauth(您的客户端系统是您运行 ssh 的系统)。您可以xauth使用以下命令找到路径:

which xauth
于 2017-07-04T22:32:05.687 回答
-3

管道stderr到一个子shell,用这个咒语过滤掉消息:

ssh yourusername@yourhost commandToRun 2> >( sed '/Warning: No xauth data/d')

无需安装,无需配置,不会出错!

于 2020-09-29T19:28:43.413 回答