使用RSA密钥的SSH连接保持询问密码
我正在尝试使用RSA密钥来设置SSH连接,而无需使用密码到许多服务器。它适用于大多数人,但一个给我一些麻烦。使用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
任何线索? 感谢您的帮助。
服务器可能被配置为拒绝基于公钥的无密码验证。我不知道Sun_SSH,但是在OpenSSH(Linux/* BSD系统上最流行的SSH实现)中,这是改变/etc/ssh/sshd_config
中的某些设置(V1协议的选项RSAAuthentication
,第2版的选项PubkeyAuthentication
)的问题。
chmod 744 ~/.ssh/authorized_keys
适合我。
“644”更好......不需要执行。而且,.ssh目录本身必须以“700”作为保证。但+1指向我在正确的方向 – 2012-11-05 14:18:46
也许你的用户被锁定在unix盒子上。如果您通常使用自己的帐户登录,然后“成为”功能用户,如果该用户启用了“密码登录”功能,但您未使用该功能,则可能会被锁定(例如,密码已过期)。 Howerver,即使是挂锁,它也不会阻止你使用“be”命令来sudo它,但它会明确地防止任何ssh登录,即使这些密钥是可信的。
好的,谢谢Olivier,不幸的是我没有再访问这些机器,所以我不能验证是否是这种情况。但如果它再次发生在我身上,我会检查这一点; o) – Damien 2012-06-19 16:14:23
请确保您的主目录(/export/home/webdev1
)也具有700
权限。
感谢您提供此信息。我没有root权限来调查Sun_SSH的配置,但这确实是问题所在。我会尽力让系统管理员参与其中。 – Damien 2010-09-02 18:50:56
'/ etc/ssh/ssd_config'应该是'/ etc/ssh/sshd_config'(或者可能是'/ etc/ssh/ssh_config') – 2013-08-29 20:56:40