使用 SSH 密钥配置新的 Digital Ocean Droplet。当我运行ssh-copy-id这就是我得到的:
ssh-copy-id
ssh-copy-id user@012.345.67.89 /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys sign_and_send_pubkey: signing failed: agent refused operation user@012.345.67.89's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'user@012.345.67.89'" and check to make sure that only the key(s) you wanted were added.
但是,当我尝试 ssh 时,会发生这种情况:
ssh user@012.345.67.89 sign_and_send_pubkey: signing failed: agent refused operation user@012.345.67.89's password:
输入密码后,我就可以正常登录了,但这当然违背了首先创建 SSH 密钥的目的。我决定看一下 ssh-agent 服务器端,这就是我得到的:
user@012.345.67.89:~# eval `ssh-agent -s` Agent pid 5715 user@012.345.67.89:~# ssh-add -l The agent has no identities.
user/.ssh/authorized_keys 确实包含一个 ssh-rsa 密钥条目,但find -name "keynamehere"没有返回任何内容。
find -name "keynamehere"
在客户端计算机上运行ssh-add,这会将 SSH 密钥添加到代理。
ssh-add
与ssh-add -l(再次在客户端上)确认它确实已添加。
ssh-add -l