2012-04-07 82 views
1

我ssh-ing从server1server2。我生成了id_rsa & id_rsa.pub文件。如果我ssh到麦克@ server2它工作正常,但ssh到约翰@ server2不工作没有密码。两个麦克& john主目录包含“.ssh”,它是chmod 700,该文件夹包含“authorized_keys”,其中只包含之前生成的id_rsa.pub文件(并且是chmod 600)的内容。两者的内容都是一样的。麻烦ssh和authorized_keys

服务器1:Linux的x86_64的x86_64的x86_64的GNU/Linux的

服务器2:AIX 5.3.0.0 64位

命令1,用户迈克(可与无密码): ssh -v -n -o StrictHostKeychecking=no -o NumberOfPasswordPrompts=0 [email protected] echo Hello

drwx------ 7 mike mike 4096 Jan 19 2011 .

的〜/ .ssh drwx------ 2 mike mike 256 Nov 28 16:39 .ssh

的〜/ .ssh /作者ized_keys -rw------- 1 mike mike 823 Apr 06 11:56 .ssh/authorized_keys


命令2,用户约翰(需要密码) ssh -v -n -o StrictHostKeychecking=no -o NumberOfPasswordPrompts=0 [email protected] echo Hello

drwx------ 12 john jgroup 4096 Apr 06 23:13 .

的〜/ .ssh drwx------ 2 john jgroup 256 Apr 06 23:56 .ssh

的〜/ .ssh/authorized_keys中-rw------- 1 john jgroup 414 Apr 06 11:55 .ssh/authorized_keys

ssh -v从上面输出命令2:

OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: Applying options for * 
debug1: Connecting to server2 [X.X.X.X] port 22. 
debug1: Connection established. 
debug1: identity file /home/will/.ssh/identity type -1 
debug1: identity file /home/will/.ssh/id_rsa type 1 
debug1: identity file /home/will/.ssh/id_dsa type -1 
debug1: loaded 3 keys 
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.0 
debug1: match: OpenSSH_5.0 pat OpenSSH* 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_4.3 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-cbc hmac-md5 none 
debug1: kex: client->server aes128-cbc hmac-md5 none 
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP 
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY 
debug1: Host 'server2' is known and matches the RSA host key. 
debug1: Found key in /home/will/.ssh/known_hosts:838 
debug1: ssh_rsa_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 

This network/computer system is for the use of authori... 
......................................................... 

debug1: Authentications that can continue: publickey,password,keyboard-interactive 
debug1: Next authentication method: publickey 
debug1: Trying private key: /home/will/.ssh/identity 
debug1: Offering public key: /home/will/.ssh/id_rsa 
debug1: Authentications that can continue: publickey,password,keyboard-interactive 
debug1: Trying private key: /home/will/.ssh/id_dsa 
debug1: Next authentication method: keyboard-interactive 
debug1: Next authentication method: password 
debug1: No more authentication methods to try. 
Permission denied (publickey,password,keyboard-interactive). 

任何人都有的,为什么它会与一个用户工作思路,而不是另一个(两者是在同一台服务器上)?

回答

2

失败的常见原因有钥匙进行身份验证:

  • 权限或所有权上的〜/ .ssh设置不正确(我看你已经检查了这些)
  • 公钥已损坏
  • 公钥是用于与私钥不同的密钥

还检查服务器的auth.log

+0

如果公钥/私钥出现问题,是否会影响与其他ID的连接? – askmike1 2012-04-07 04:57:31

+0

注意“公钥是用于与私钥不同的密钥”。从文件大小来看,我猜你在第一个账户的authorized_keys中有另一个密钥。也许那个其他的密钥实际上是你在ssh时使用的密钥? – 2012-04-07 07:12:33

+0

我从mike的authorized_keys中删除了另一个密钥,它仍然与该用户一起工作。 – askmike1 2012-04-07 11:34:36

0

你能够登录,因为迈克是一个真正的击球手。您可以尝试制作一个authorized_keys2文件。 authorized_keys不适用于所有版本的OpenSSH。

ln -s authorized_keys authorized_keys2