The remote SSH server rejected X11 forwarding request

首先主机ssh访问虚拟机的前提是主机能够ping通虚拟机,如果不知道如何设置可以参考我的博文:

VirtualBox 虚拟机和宿主机之间的网络连接,虚拟机和主机都可以上网

然后:如果在ssh访问虚拟机时出现 The remote SSH server rejected X11 forwarding request;或者连接失败

The remote SSH server rejected X11 forwarding request_第1张图片

到虚拟机里,先打开确保ssh服务打开:

service sshd status

The remote SSH server rejected X11 forwarding request_第2张图片

可以看到ssh服务打开,并且时openssh

然后修改ssh配置:

/etc/ssh/sshd_config文件中的X11Forwarding参数为yes

将UseLogin参数为no,可能这一行最开始是被注释,去掉注释即可解决

The remote SSH server rejected X11 forwarding request_第3张图片

然后保存退出,

The remote SSH server rejected X11 forwarding request_第4张图片

至此已经正常连接了

 

 

你可能感兴趣的:(Linux,ssh,centos)