检查ssdd配置中x11forwarding 为yes
> grep 'X11' /etc/ssh/sshd_config
X11Forwarding yes
# X11DisplayOffset 10
# X11UseLocalhost yes
# X11Forwarding no
安装 xauth和xorg-x11-fonts
> yum install xauth
Installing:
xorg-x11-xauth x86_64 1:1.0.9-1.el7 base 30 k
Installing for dependencies:
libICE x86_64 1.0.9-2.el7 base 65 k
libSM x86_64 1.2.2-2.el7 base 39 k
libXmu x86_64 1.1.2-2.el7 base 71 k
libXt x86_64 1.1.4-6.1.el7 base 173 k
> yum install xorg-x11-fonts-Type1
Installing:
xorg-x11-fonts-Type1 noarch 7.5-9.el7 base 521 k
Installing for dependencies:
libXfont x86_64 1.5.1-2.el7 base 150 k
libfontenc x86_64 1.1.2-3.el7 base 30 k
ttmkfdir x86_64 3.0.9-42.el7 base 48 k
xorg-x11-font-utils x86_64 1:7.5-20.el7 base 87 k
退出用户重新登录
查看环境变量已经多了DISPLAY
export
declare -x DISPLAY="localhost:10.0"
使用mobaxterm启动一个带图形界面的程序试试吧
参考:
Gtk-WARNING ** cannot open display on CentOS 7 minimal server install
https://superuser.com/questions/310197/how-do-i-fix-a-cannot-open-display-error-when-opening-an-x-program-after-sshi
https://www.linuxidc.com/Linux/2017-10/148145.htm
http://blog.csdn.net/Lux_Veritas/article/details/19244349