让Windows 10上的Ubuntu bash运行ssh -X 以在远程服务器上获取GUI环境
安装以下所有内容。在Window上,安装Xming。在Ubuntu bash上,使用sudo apt installinstall ssh xauth xorg。
sudo apt install ssh xauth xorg
转到包含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
在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
现在,由于我们已经完成了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
注意:链接的文本包含2个错别字(XauthLocaion而不是XauthLocation)