ssh登陆提示Too many authentication failures for wyq

2014年5月05日 16:58

 
碰到使用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不行吗?
默认值很合理的,完全没有必要修改.
 

Tags: ssh
评论(2) 阅读(7156)

内网到外网的隧道

2014年1月15日 23:22

今天需要在内网机器上安装一个包,而且没有与系统版本匹配的rpm. 所以只能自己编译安装。编译时出现错误,原因是系统没有安装gcc. 只好再安装gcc,然而再次出现问题,发现缺少gcc的依赖了,而且是一堆的依赖包. 没有办法,只能再一个个安装依赖包. 相信手动安装过linux软件的人,能够深深体会到相互依赖问题会让人有多痛苦。 好不容找到这些特定版本的包,最后出现悲剧了,貌似其中几个依赖包,由版本比较老,网上已经没有了。而且由于内核版本的原因,gcc也只能安装这个版本的。
 
结果出现了安装某个包,需要gcc,安装gcc,需要依赖包,部分依赖包找不到。并且内核限制了只能安装这个版本的gcc。并且系统的安装盘是精简版的,没有常用软件的安装包.
 
找依赖包已经让人很痛苦了,结果是这样,让人很恼火. 下定决心要在内网机器上使用yum,用它来解决这个问题。
为达到这个目的,需要在内网和外网间搭一条隧道,让内网能访问外网。
 
工作的网络环境
工作是在外网,系统在独立的内部网络。在外网访问内网需要通过专门的vpn软件。
这个vpn软件,只能运行在windows下,使外网机器拥有临时的内网地址,运行时外网机器不能访问外网。
 
其中网内到外网的端口转发
proxychains ssh  -N -D 1090 wyq@192.168.1.102
 
这里面最要的不是怎么建数据通道,而是怎么绕过这个特定的vpn软件.
工作原因实现方法只能略说.
 
 
 

Tags: ssh proxychains
评论(1) 阅读(2007)

ssh别名登录

2013年12月31日 17:11

经常使用ssh远程登录,每次都敲一长串字符。重复多了,有砸键盘的冲动。后来发现可用别名代替。

在~/.ssh/config 中加入以下内容

Host mt98   //快捷名
HostName 135.32.9.98 //主机名
User monitor  //用户名

然后可用ssh mt98登陆

运行时出现错误

ssh: Could not resolve hostname mt98: Name or service not known

config文件需要改成和known_hosts的所有者一致.

Tags: ssh
评论(4) 阅读(1888)