gnome-keyring blocking ssh access

I had to connect to our servers to perform daily maintenance, but suddendly I was getting error:

ssh arc

Received disconnect from zzz.zzz.zzz.zzz port 1234:2: Too many authentication failures

# and also

sign_and_send_pubkey: signing failed: agent refused operation

I was able to login using password, with:

ssh -p 1234 -i ~/.ssh/ -o PubkeyAuthentication=no  root@$IP

But I was unable to use our keys.

Then, I realised the problem was coming from the use of gnome-keyring.

gnome-keyring doesn’t always handle specific formats of SSH keys correctly. Unfortunately, gnome-keyring was trying to handle all SSH key usage, preventing the keys from working.

you can confirm that gnome-keyring is at fault on your system by added SSH_AUTH_SOCK=0 in front of the ssh command as follows:

SSH_AUTH_SOCK=0 ssh arc

In order to fix the gnome-keyring interference, the SSH Key Agent will have to be disabled from the startup applications.

Also, the current instance must be terminated (to avoid rebooting).

PS: a useful page.