我已经为A用户到B计算机的root用户成功创建了基于密钥的身份验证。
现在,我在B机器上创建了一个与A机器相同的新用户,我们称他为USER
。我在B机上为他创建了一个主目录/home/USER
,我想为他从A机到B机创建基于密钥的身份验证。
所以,我在A机上跑了
ssh-keygen -t rsa
,接受所有路径,因此/home/USER/.ssh/id_rsa
不带任何短语ssh-copy-id -i /home/USER/.ssh/id_rsa.pub USER@BmachinesIP
,输入密码并得到按摩
现在尝试登录机器bla bla bla
因此,一切似乎都还可以。
但是,当我尝试连接时ssh USER@BmachinesIP
,系统要求输入密码。我试图查看日志并运行ssh -vvv USER@BmachinesIP
,这是输出的一部分:
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/USER/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/USER/.ssh/id_dsa
debug3: no such identity: /home/USER/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
USER@BmachinesIP's password:
那么,谁能告诉我我做错了什么或应该改变什么?也许问题出在权限中,它们是:
在机器上:
drwx------ 2 USER USER SIZE DATE TIME .ssh
-rw------- 1 USER USER 1675 2011-10-31 14:36 id_rsa
-rw-r--r-- 1 USER USER 413 2011-10-31 14:36 id_rsa.pub
在B机上:
drwx------ 2 USER defaultGroup SIZE DATE TIME .ssh
-rw------- 1 USER defaultGroup SIZE DATE TIME authorized_keys