While attempting to connect to some server over SSH, you may get the error as follows:
sign_and_send_pubkey: signing failed for RSA “/home/<username>/.ssh/id_rsa” from agent: agent refused operation
The “agent refused operation” error is usually caused by too open permissions on a private key file.
In this short note i am showing how to fix this error.
Cool Tip: Slow SSH login? Password prompt takes too long? You can easily remove the delay! Read more →
Signing Failed: Agent Refused Operation
Run ssh-add
command on the client machine to add the SSH key to the agent:
$ ssh-add
To force the SSH key to be kept permanently, add it to your ~/.ssh/config
file:
Host * IdentityFile /home/<username>/.ssh/id_rsa
If ssh-add
causes the message as follows, it means it is required to set more restrictive permissions on the private key file:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0744 for '/home/<username>/.ssh/id_rsa' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored.
To set the proper permissions, execute:
$ chmod 600 /home/<username>/.ssh/id_rsa
Once the permissions are fixed, the “signing failed: agent refused operation” issue should be solved and you should be able to SSH normally.
Cool Tip: Disable SSH host key checking! Read more →
Thanks so much for sharing your knowledge.
Have a great day.
soy un novato en esto, me solucionaste el problema, mil gracias.