用SSH密钥配置一个新的数字海洋液滴。当我运行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.

用户/。Ssh /authorized_keys也包含Ssh -rsa密钥条目,但是find name "keynamehere"没有返回任何内容。


当前回答

注意如何命名ssh密钥文件

如果您有多个密钥对,您可以使用ssh-keygen和-f <密钥名称>来命名输出文件。在我的例子中,我将密钥命名为username@organization和username@organization.pub,这有助于保持多个密钥对的组织。

问题是ssh代理不喜欢@字符。

在我的例子中,这导致了sign_and_send_pubkey: signing failed: agent refused操作错误,并阻止会话密匙环与ssh代理交互。

将密钥文件重命名为username_at_organization解决了这个问题。

其他回答

In my case the problem was that GNOME keyring was holding an invalid passphrase for the ssh key to be used. After spending indecent amount of time troubleshooting this issue I ran seahorse and found the entry to hold empty string. I can only guess that it was caused by mistyping the passphrase at first use some time earlier, and then probably cancelling the requester or so in order to fall back to command line. Updating the entry with correct passphrase immediately solved the problem. Deleting that entry (from "login" keyring) and reentering passphrase at that first prompt (and checking the appropriate checkbox) solves this too. Now agent gets the correct passphrase from the unlocked at login keyring named "login" and neither asks for passphrase nor "refuses operation" anymore. Of course YMMV.

根据Github安全博客,SHA-1的RSA密钥不再被接受。

使用以下命令创建新的带有ECDSAencryption的SSH密钥,并将其添加到Github。

ssh-keygen -t ecdsa -b 521 -C "your_email@example.com"

原始答案和细节可以在这里找到

当使用gpg-agent作为我的ssh-agent并使用gpg子密钥作为我的ssh密钥https://wiki.archlinux.org/index.php/GnuPG#gpg-agent时,我出现了错误。

我怀疑这个问题是由我在摇摆配置中使用的sleep+lock命令导致的gpg的无效pin输入tty引起的

bindsym $mod+Shift+l exec "sh -c 'gpg-connect-agent reloadagent /bye>/dev/null;systemctl暂停;swaylock’”

或者只是睡眠/暂停

重置引脚输入tty以解决问题

全球连线代理updatestarptty /dev/null

和修复我的摇摆睡眠+锁定命令:

bindsym $mod+Shift+l exec "sh -c 'gpg-connect-agent reloadagent /bye>/dev/null;systemctl暂停;swaylock;Gpg-connect-agent updatestartuptty /bye > /dev/null'"

是的。在客户端机器上运行ssh-add。 然后重复执行命令ssh-copy-id userserver@012.345.67.89

在将Fedora 26升级到28之后,我遇到了同样的问题。 下面的日志也不见了

/var/log/secure
/var/log/messages

问题:

antop@localmachine  ~  ssh root@ocp1.example.com
sign_and_send_pubkey: signing failed: agent refused operation
root@ocp1.example.com's password:

错误信息没有指向实际问题。问题由

chmod 700 ~/.ssh
chmod 600 ~/.ssh/*