在使用CentOS7login时延迟很长

我有一个CentOS 7系统,当我用putty或者sshlogin的时候,在得到密码提示之前有一个很长的延迟。 我运行ssh -v,发现它已经到了这个地步:

debug1: ssh_ecdsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received 

然后坐在那里1-2分钟,然后输出:

 debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password debug1: Next authentication method: gssapi-keyex debug1: No valid Key exchange context debug1: Next authentication method: gssapi-with-mic debug1: Unspecified GSS failure. Minor code may provide more information No Kerberos credentials available debug1: Unspecified GSS failure. Minor code may provide more information No Kerberos credentials available debug1: Unspecified GSS failure. Minor code may provide more information debug1: Unspecified GSS failure. Minor code may provide more information No Kerberos credentials available debug1: Next authentication method: publickey debug1: Trying private key: /home/motor/.ssh/id_rsa debug1: Trying private key: /home/motor/.ssh/id_dsa debug1: Trying private key: /home/motor/.ssh/id_ecdsa debug1: Trying private key: /home/motor/.ssh/id_ed25519 debug1: Next authentication method: password 

然后密码提示出来。 无论哪个用户login,都会发生这种情况。只发生在1系统上。 我有另外5个人在没有拖延的情况下继续前进。

日志中没有磁盘或内存或任何其他错误。

有什么可能导致它像这样延迟?

更新:

我尝试设置GSSAPIAuthentication为否,并没有解决这个问题。

我再次运行ssh,这次用-vvv。 这个输出结果出来,然后挂起来:

 debug1: SSH2_MSG_SERVICE_ACCEPT received debug2: key: /home/motor/.ssh/id_rsa ((nil)), debug2: key: /home/motor/.ssh/id_dsa ((nil)), debug2: key: /home/motor/.ssh/id_ecdsa ((nil)), debug2: key: /home/motor/.ssh/id_ed25519 ((nil)), 

1-2分钟后出来了:

 debug1: Authentications that can continue: publickey,password debug3: start over, passed a different list publickey,password debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Trying private key: /home/motor/.ssh/id_rsa debug3: no such identity: /home/motor/.ssh/id_rsa: No such file or directory debug1: Trying private key: /home/motor/.ssh/id_dsa debug3: no such identity: /home/motor/.ssh/id_dsa: No such file or directory debug1: Trying private key: /home/motor/.ssh/id_ecdsa debug3: no such identity: /home/motor/.ssh/id_ecdsa: No such file or directory debug1: Trying private key: /home/motor/.ssh/id_ed25519 debug3: no such identity: /home/motor/.ssh/id_ed25519: No such file or directory debug2: we did not send a packet, disable method debug3: authmethod_lookup password debug3: remaining preferred: ,password debug3: authmethod_is_enabled password debug1: Next authentication method: password 

然后密码提示。

在远程服务器的/etc/ssh/sshd_config ,您应该将选项GSSAPIAuthentication更改为no。 重新启动sshd,你应该很好去。

编辑:GSSAPI(通用安全服务应用程序编程接口)本质上是一个API,利用Kerberos库提供强大的networkingencryption。 除非您需要启用GSSAPI的特定原因,否则此方法应解决您遇到的问题。

编辑2:为了清楚起见,反向DNS检查可能会超时(特别是检查连接主机的PTRlogging)。 SSH做这个检查当然是因为它作为validation连接主机的安全措施。

说这个过程并没有增加真正的安全性,因为实际上有很大一部分主机没有PTR。 有三种方法可以解决这个问题:

1)。 您可以修改sshd_config文件以使用UseDNS no参数。 这将停止反向DNS查找。 这样做是安全的。

2)。 在缓慢连接的主机的适当DNS系统中添加PTRlogging。

3)。 使用相关条目在OS hosts文件中添加手动条目。

希望有所帮助!

这听起来像是一个DNS问题 – 在login尝试期间,将执行反向DNS查找以提供身份validation日志中的远程主机名。

检查以确保服务器在/etc/resolv.conf文件中没有没有响应的parsing器。