本篇文章前提是客户端(本地)能够成功ssh至服务器端(包括使用ipv6地址)。要在客户端(本地)能够打开图片,需要做以下配置:
客户端(本地)配置
编辑 /etc/ssh/ssh_config文件
sudo vi /etc/ssh/ssh_config
修改其中片段如下:
Host *
ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes
服务器端配置
1.编辑 /etc/ssh/sshd_config文件
sudo vi /etc/ssh/sshd_config
修改片段至:
UsePAM yes
AllowAgentForwarding yes
AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
2.在命令行输入:
export DISPLAY=localhost:10.0
3.打开图片测试OK