经与SSH和authorized_keys的麻烦(Having trouble with ssh a

2019-09-16 09:34发布

我的ssh-ING在Server1Server2。 我生成的id_rsaid_rsa.pub文件。 如果我ssh迈克@ Server2上它工作正常,但ssh来约翰@ Server2上不无密码工作。 两个麦克风和约翰主目录包含“的.ssh”,这是搭配chmod 700以及文件夹中包含‘authorized_keys的’仅包含先前生成的id_rsa.pub文件的内容(并且CHMOD 600)。 两者的内容是相同的。

服务器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 mike@server2 echo Hello

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

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

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


命令2,用户约翰(需要密码) ssh -v -n -o StrictHostKeychecking=no -o NumberOfPasswordPrompts=0 john@server2 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

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

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).

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

Answer 1:

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

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

还检查服务器的auth.log



Answer 2:

那你可以登录麦克是一个真正难倒的。 你可以尝试做一个authorized_keys2文件。 authorized_keys不上的OpenSSH的所有版本。

ln -s authorized_keys authorized_keys2


文章来源: Having trouble with ssh and authorized_keys