SSH 服务器拒绝 X11 转发请求

SSH 服务器拒绝 X11 转发请求

环境:centos 7、xshell、xmanager。

我有两台centos7虚拟机,其中一台可以在SSH会话中通过X11转发成功打开Chrome浏览器,但是另一台不能。

正常情况:

[root@localhost ~]# google-chrome --no-sandbox
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
[16458:16458:0523/075723.020611:ERROR:gl_surface_glx.cc(419)] GLX 1.3 or later is required.
[16458:16458:0523/075723.020636:ERROR:gl_initializer_x11.cc(153)] GLSurfaceGLX::InitializeOneOff failed.
[16458:16458:0523/075723.022497:ERROR:gpu_child_thread.cc(254)] Exiting GPU process due to errors during initializat
[16393:16422:0523/075723.081833:ERROR:browser_gpu_channel_host_factory.cc(108)] Failed to launch GPU process.
[root@localhost ~]# [0523/075728.166795:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandb
Most likely you need to configure your SUID sandbox correctly

不正常的:

WARNING! The remote SSH server rejected X11 forwarding request.

[root@yxs ~]# google-chrome --no-sandbox

(google-chrome:10346): Gtk-WARNING **: cannot open display: 
[root@yxs ~]# [0523/202401.444038:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
^C
[root@yxs ~]# su yxs
[yxs@yxs root]$ google-chrome

(google-chrome:10407): Gtk-WARNING **: cannot open display: 

二者以下配置几乎一致。

正常的情况:

[root@localhost ~]# cat /etc/ssh/sshd_config | grep X11
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#   X11Forwarding no
[root@localhost ~]# rpm -qa | grep xauth
xorg-x11-xauth-1.0.9-1.el7.x86_64
[root@localhost ~]# ssh -V
OpenSSH_6.6.1p1, OpenSSL 1.0.1e-fips 11 Feb 2013
[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 
[root@localhost ~]# echo $DISPLAY
localhost:10.0

#enable ipv6
#minimal centos

不正常的:

[root@yxs ~]# cat /etc/ssh/sshd_config | grep X11
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#   X11Forwarding no
[root@yxs ~]#  rpm -qa | grep xauth
xorg-x11-xauth-1.0.9-1.el7.x86_64
[root@yxs ~]# ssh -V
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
[root@yxs ~]# echo $DISPLAY

[root@yxs ~]#

#disbale ipv6
#has installd "GNOME Desktop"

我尝试在异常的虚拟机上执行export DISPLAY=localhost:10.0,但是重启后环境变量$DISPLAY又变空了。

我只是无法google-chrome --no-sandbox通过Xshell中的SSH会话通过命令打开Chrome。但我可以通过虚拟机管理上的VNC窗口正常使用。

答案1

因为我禁用了IPv6,所以需要添加AddressFamily inet/etc/ssh/sshd_config之前太粗心了。抱歉。

这个答案:关联

相关内容