使用RSA密钥的ssh连接不断询问密码

时间:2010-08-30 23:01:40

标签: ssh solaris rsa

我正在尝试使用RSA密钥在没有密码的情况下为许多服务器设置SSH连接。它适用于大多数人,但有一个给我带来了一些麻烦。

我过去发现的最常见的问题是远程主机上的.ssh或authorized_keys的权限问题,但这里它们似乎是正确的,如下所示:

drwx------  ~/.ssh
-rw-r--r--  ~/.ssh/authorized_keys

这是ssh -v命令输出到此服务器(我刚刚更改了主机名和IP):

Sun_SSH_1.1.3, SSH protocols 1.5/2.0, OpenSSL 0x0090704f
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: ssh_connect: needpriv 0
debug1: Connecting to myhost.mydomain.com [123.123.123.123] port 22.
debug1: Connection established.
debug1: identity file /export/home/webdev1/.ssh/identity type -1
debug1: identity file /export/home/webdev1/.ssh/id_rsa type 1
debug1: identity file /export/home/webdev1/.ssh/id_dsa type -1
debug1: Remote protocol version 1.5, remote software version 1.2.31
debug1: match: 1.2.31 pat 1.2.1*,1.2.2*,1.2.3*
debug1: Local version string SSH-1.5-Sun_SSH_1.1.3
debug1: Waiting for server public key.
debug1: Received server public key (768 bits) and host key (1024 bits).
debug1: Host 'myhost.mydomain.com' is known and matches the RSA1 host key.
debug1: Found key in /export/home/webdev1/.ssh/known_hosts:6
debug1: Encryption type: 3des
debug1: Sent encrypted session key.
debug1: cipher_init: set keylen (16 -> 32)
debug1: cipher_init: set keylen (16 -> 32)
debug1: Installing crc compensation attack detector.
debug1: Received encrypted confirmation.
debug1: Doing password authentication.

我怀疑这可能是由于SSH版本造成的。另一个工作的服务器给我以下输出(远程协议版本2.0而不是1.5):

debug1: Remote protocol version 2.0, remote software version Sun_SSH_1.1.3
debug1: match: Sun_SSH_1.1.3 pat Sun_SSH_1.1.*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-Sun_SSH_1.1.3

有任何线索吗? 谢谢你的帮助。

5 个答案:

答案 0 :(得分:3)

chmod 744 ~/.ssh/authorized_keys

适合我。

答案 1 :(得分:2)

确保您的主目录(/export/home/webdev1)也具有700权限。

答案 2 :(得分:1)

尝试

chmod -R 600 ~/.ssh/

可能群组/全局读取权限导致问题。

答案 3 :(得分:1)

服务器可能配置为拒绝基于公钥,无密码的身份验证。我不了解Sun_SSH,但在OpenSSH(Linux / * BSD系统上最流行的SSH实现)中,这是一个改变/etc/ssh/sshd_config中的一些设置的问题(v1协议的选项RSAAuthentication,{{ 1}} for v2)。

答案 4 :(得分:1)

也许您的用户被锁定在unix框中。如果您通常使用自己的帐户登录,然后“成为”功能用户,如果该用户启用了“密码登录”功能但您没有使用它,则可能会被锁定(例如密码已过期)。 Howerver,即使它是一个小盒子,它也不会阻止你用“be”命令对它进行sudo,但它肯定会阻止任何ssh登录,即使密钥是可信的。

相关问题