sign_and_send_pubkey: signing failed: agent refused operation ssh – solved

When SSHing into a machine you might receive the following error “sign_and_send_pubkey: signing failed: agent refused operation”. This could be as a result of one of two issues:

  1. Incorrect permissions for the .ssh folder or keys therein
  2. SSH key has not been added to the agent

1. Incorrect permissions for the .ssh folder or keys therein

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

2. SSH key has not been added to the agent

ssh-add