I have a number of ssh keys used for various different purposes where it makes sense not to share the same key across different environments. Up to now that’s worked just fine. Today I added another. Some time later, I tried to log into a local system and without any kind of prompt I got an error saying that there had been too many authentication failures when I know it worked yesterday.
At first I didn’t understand what was going on as I could log in fine from another machine, but after I while I twigged what was happening. The ssh server at the remote end obviously has a limit on the number of failures it will accept when trying to log in. That’s fine and expected. However, when I tried to log in the ssh client process tried each available key in turn. Before it could get to the valid one however, it reached the limit on the number of authentication attempts and the server killed the connection.
I guess there are two obvious workarounds for this. The first is to raise the limit on the number of failed login attempts for the ssh server, but that seems a fairly crap way out of the hole. Short of any other bright ideas, my favoured option is to edit my personal ssh configuration file and force the IdentityFile option to use the key I want.