我怎样才能防止警告没有xauth数据; 使用假身份validation数据进行X11转发?

每次我从我的Mac启动一个SSH连接到Linux(Debian)我得到这个警告:

No xauth data; using fake authentication data for X11 forwarding. 

这也发生在使用ssh的工具上,比如git或者mercurial。

我只是想对我的系统进行本地更改,以防止出现这种情况。

注意:我在我的Mac OS X(10.8.1)上有X11服务器(XQuartz 2.7.3(xorg-server 1.12.4)),并且工作正常,我可以在本地或远程成功启动时钟。

没有发布的解决scheme为我工作。 我的客户端(桌面)系统正在运行macOS 10.12.5(Sierra)。 我添加了-vssh命令的选项,它告诉我,

 debug1: No xauth program. 

这意味着它没有正确的path到xauth程序。 (在此版本的macOS中, xauth的path是非标准的。)解决scheme是将此行添加到/etc/ssh/ssh_config

 XAuthLocation /opt/X11/bin/xauth 

现在警告信息不见了

find原因,我~/.ssh/config不完整,你需要两个:

 Host * ForwardAgent yes ForwardX11 yes 

我的错误是,我只包含ForwardX11选项。

如上所述,OS X Yosemite上的xauth似乎已经退化为与XQuartz的$DISPLAY设置无关的旧版本:

 % xauth -V 1.0.9 % xauth generate $DISPLAY . xauth: (argv):1: bad display name "/private/tmp/com.apple.launchd(...)/org.macosforge.xquartz:0" in "add" command 

目前MacOS中存在一个错误。 我也遇到了这个。 我的修复涉及到以下添加到我的.bash_profile

 dispdir=`dirname $DISPLAY` dispfile=`basename $DISPLAY` dispnew="$dispdir/:0" if [ -e $DISPLAY -a "$dispfile" = "org.x:0" ]; then mv $DISPLAY $dispnew fi export DISPLAY=$dispnew 

本质上,与X根相关的文件pipe道的名称无法正确处理,因此需要更正。 🙂

包含

XAuthLocation / opt / local / bin / xauth在〜/ .ssh / config中

在我的macOS Sierra 10.12.6为我工作。 从答案7)一个小的变化。

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

  • 第一

安装以下所有内容。 在Window上安装Xming 。 在Ubuntu bash上,使用sudo apt install来安装ssh xauth xorg

 sudo apt install ssh xauth xorg 
  • 第二

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

  • 第三

以pipe理员身份编辑ssh_config (USE sudo )。 在ssh_config里面,去掉ForwardAgentForwardX11ForwardX11Trusted行中的hash # ,并将相应的参数设置为yes

 # /etc/ssh/ssh_config Host * ForwardAgent yes ForwardX11 yes ForwardX11Trusted yes 
  • 向前

ssh_config文件中,删除Port 22Protocol 2之前的前面的哈希# ,并在文件末尾附加一个新行来声明xauth文件的位置, XauthLocaion /usr/bin/xauth ,记得写下你自己的path文件。

 # /etc/ssh/ssh_config # IdentifyFile ... Port 22 Protocol 2 # Cipher 3des # ... # ... ... ... GSSAPIDelegateCredentials no XauthLocaion /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

我只是从我的根文件夹中删除〜/ .Xauthority(目标机器),再次ssh -X 192.168.123.1和ik工作。

在我的情况下,这是包含Magic cookie的.Xauthority的问题,Fabby在http://askubuntu.com/questions/571116/上build议在2014-11-14将这行添加到.bashrc的末尾或。 configuration文件允许在用户之间转发xauth密钥时调用su:

 export $(dbus-launch) 

我还补充说:

 export XAUTHORITY=~/.Xauthority 

确保使用ssh -X̍@远程调用将会find它。

在我的情况.Xauthority是一个符号链接原始用户/ home //。权威我su从…

  cd /home/<child_user>;ln -sf /home/<parent_user>/.Xauthority .xAuthority 

有正确的权利:

  sudo chown <parent_user> /home/<parent_user>/.profile chmod a+rw /home/<parent_user>/.profile 

所以它是可以访问和。 将能够触发应用程序,并在整个代理帐户的本地屏幕上显示X窗口的结果!

提示:检查xauth列表…如果反映了魔法cookie。