从Fedora 23到Centos 7进行ssh连接时,我遇到了一个不幸的问题.命令ssh -X user@centos7和ssh -Y user@centos7打印警告:没有xauth数据; 使用伪认证数据进行X11转发.
谷歌搜索显示将以下行添加到/ etc/ssh/ssh_config:
Host *
ForwardX11Trusted yes
ForwardAgend yes
ForwardX11 yes
Run Code Online (Sandbox Code Playgroud)
但这并没有使警告信息消失.
对我来说,这个问题是由我的Fedora系统没有~/.Xauthority文件引起的.
我创建了一个在Fedora系统上执行以下命令:
xauth add :0 . `mcookie`
Run Code Online (Sandbox Code Playgroud)
小智 6
ssh -X 以在远程服务器上获得GUI环境安装以下所有内容.在Windows上,安装X服务器,例如Xming.在Ubuntu bash上,用于sudo apt install安装ssh xauth xorg.
sudo apt install ssh xauth xorg
Run Code Online (Sandbox Code Playgroud)
转到文件夹包含ssh_config文件,我的是/etc/ssh.
ssh_config以管理员身份编辑(USE sudo).里面ssh_config,删除哈希#中的台词ForwardAgent,ForwardX11,ForwardX11Trusted,并设置相应的参数yes.
# /etc/ssh/ssh_config
Host *
ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes
Run Code Online (Sandbox Code Playgroud)
在ssh_config文件中,删除#之前的哈希值,Port 22并在文件Protocol 2末尾添加一个新行以声明xauth文件位置XauthLocation /usr/bin/xauth,记住编写自己的xauth文件路径.
# /etc/ssh/ssh_config
# IdentifyFile ...
Port 22
Protocol 2
# Cipher 3des
# ...
# ...
...
...
GSSAPIDelegateCredentials no
XauthLocation /usr/bin/xauth
Run Code Online (Sandbox Code Playgroud)
现在我们已经完成了编辑ssh_config文件,在我们离开编辑器时保存它.现在转到文件夹~或$HOME附加export DISPLAY=localhost:0到您的.bashrc文件并保存.
# ~/.bashrc
...
...
export DISPLAY=localhost:0
Run Code Online (Sandbox Code Playgroud)
我们差不多完成了.重新启动bash shell,打开Xming程序并使用ssh -X yourusername@yourhost.然后享受GUI环境.
ssh -X yourusername@yourhost
Run Code Online (Sandbox Code Playgroud)
问题还出现在Windows上的Ubuntu子系统中,链接位于
https://gist.github.com/DestinyOne/f236f71b9cdecd349507dfe90ebae776
参见https://serverfault.com/a/859370/423488
您可能必须/etc/ssh/ssh_config在客户端系统上添加如下行:
XAuthLocation /opt/X11/bin/xauth
Run Code Online (Sandbox Code Playgroud)
但是,请使用xauth客户端系统上程序的实际路径(客户端系统是运行ssh的路径)。您可以xauth使用以下命令找到路径:
which xauth
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17279 次 |
| 最近记录: |