让 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
中的哈希,并将相应的参数设置为。#
ForwardAgent
ForwardX11
ForwardX11Trusted
yes
# /etc/ssh/ssh_config
Host *
ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes
在file中,去掉and之前ssh_config
的前面的hash ,并在文件末尾追加一个新行来说明xauth文件的位置,记得写下你自己的xauth文件路径。#
Port 22
Protocol 2
XauthLocation /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