(转)redhat7.3 ssh无法登陆

来源:互联网 发布:物流排队网络 编辑:程序博客网 时间:2024/05/21 18:42

今天新安装了个redhat7.3玩玩,发现ssh的时候无法登陆。

xshell提示信息是:


Connecting to 8.8.8.8:22...

Connection established.To escape to local shell, press 'Ctrl+Alt+]'.Connection closed by foreign host.

会出现这种问题是因为ssh默认有一个配置项UseDNS(文档中解释此配置项的意思为:UseDNS Specifies whether sshd should look up the remote host name and check that the resolved host name for the remote IP address maps back to the very same IP address. The default is “yes”.

当此项配置不开启时默认值为UseDNS yes,这样会导致ssh在有连接过来的时候进行dns解析,所以会产生较长时间的停顿,所以要解决此问题可以将此配置项打开,然后值改为no,操作如下:

vim /etc/ssh/sshd_config

在sshd_config的文件当中查找UseDNS(注意大小写)将其#去掉并修改为no:

UseDNS no

然后重启一下服务。

systemctl restart sshd.service

在进行测试问题解决。

转载并感谢:http://www.bbtang.info/linux/fuwu/431.html?spm=5176.bbsr158854.0.0.IsF2aG



原创粉丝点击