ssh登陆提示Too many authentication failures for wyq


碰到使用ssh登陆,直接出现认证失败次数太多的问题.

在自己机器上模拟了下面测试.

ssh登陆系统,未输入密码就提示认证失败

[wyq@localhost ~]$ ssh wyq@192.168.1.107
Received disconnect from 192.168.1.107: 2: Too many authentication failures for wyq

查看/etc/sshd/sshd_config尝试认证次数

MaxAuthTries 1

最大认证次数为1,为什么还没有输入密码就已经提示 Too many authentication failures ?

开启ssh的debug模式

[wyq@localhost ~]$ ssh -v wyq@192.168.1.107
OpenSSH_6.4, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /home/wyq/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 51: Applying options for *
debug1: Connecting to 192.168.1.107 [192.168.1.107] port 22.
debug1: Connection established.
debug1: identity file /home/wyq/.ssh/id_rsa type 1
debug1: identity file /home/wyq/.ssh/id_rsa-cert type -1
debug1: identity file /home/wyq/.ssh/id_dsa type -1
debug1: identity file /home/wyq/.ssh/id_dsa-cert type -1
debug1: identity file /home/wyq/.ssh/id_ecdsa type -1
debug1: identity file /home/wyq/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.4
debug1: match: OpenSSH_6.4 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 66:29:e1:f3:32:92:64:da:98:bc:ab:f8:9c:a4:63:02
debug1: Host '192.168.1.107' is known and matches the ECDSA host key.
debug1: Found key in /home/wyq/.ssh/known_hosts:21
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
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
Cannot determine realm for numeric host address

debug1: Unspecified GSS failure.  Minor code may provide more information
Cannot determine realm for numeric host address

debug1: Unspecified GSS failure.  Minor code may provide more information


debug1: Unspecified GSS failure.  Minor code may provide more information
Cannot determine realm for numeric host address

debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/wyq/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/wyq/.ssh/id_dsa
debug1: Trying private key: /home/wyq/.ssh/id_ecdsa
debug1: Next authentication method: password
wyq@192.168.1.107's password:

发现在提示输入密码前它已经进行了几次验证

debug1: Next authentication method: gssapi-keyex
debug1: Next authentication method: gssapi-with-mic
debug1: Next authentication method: publickey
debug1: Next authentication method: password

原来在密码认证之前,ssh已经进行了几种认证.
应该是他们导致的,具体原因就不是很清楚.

还有一个问题就是MaxAuthTries值再大,也只能输入三次密码.
这个问题也很疑惑的.

挺奇怪的,管理人员怎么喜欢修改MaxAuthTries的值?
ssh登陆密码输入错误,被中断后,别人再ssh不行吗?
默认值很合理的,完全没有必要修改.



上篇: cnpm包管理工具 下篇: 局域网如何访问外网