SSH Fix for Agent admitted failure to sign using the key
After generating keys and setting up authorized_keys correctly, you may encounter this error when trying to shell into the remote machines:
Agent admitted failure to sign using the key
Agent admitted failure to sign using the key
You’re forced to supply the password, and then it works. So what’s the problem? Identity. You need to run ssh-add. So from scratch, i’ll reproduce the problem and solution.
Generate keys on both hosts.
|
1 2 3 |
user@host1:~$ ssh-keygen -t rsa -N '' user@host1:~$ ssh-keygen -t dsa -N '' user@host1:~$ cat ~/.ssh/id_rsa.pub > authorized_keys |
Then you do the same thing on the other machine. Now cat the remote public key and append it to your authorized_keys file.
|
1 |
user@host1:~$ ssh host2 cat ~/.ssh/id_rsa.pub >> authorized_keys |
Your authorized_keys file should have the public key from both hosts inside. Copy authorized_keys to the remote host again to overwrite his version with yours.
|
1 |
user@host1:~$ scp ~/.ssh/authorized_keys host2:~/.ssh/ |
At this point everything should work, but doesn’t.
|
1 2 3 |
user@host1:~$ ssh host2 Agent admitted failure to sign using the key. user@host2's password: |
Run ssh-add and voila, problem solved.
|
1 2 3 |
~/.ssh$ ssh-add Identity added: /home/user/.ssh/id_rsa (/home/user/.ssh/id_rsa) Identity added: /home/user/.ssh/id_dsa (/home/user/.ssh/id_dsa) |
Now you should be able to log in or run individual commands on the remote host without getting prompted for a password.