This error usually isn't a wrong password — it's your SSH client offering too many keys before the right one. The server cuts you off after a few tries. Here's the fix, and what to do if you actually are locked out.
Quick answer
"Too many authentication failures" usually means your SSH client offered several keys before the right one and the server cut you off. Offer only the correct key: ssh -o IdentitiesOnly=yes -i ~/.ssh/yourkey user@server, or set IdentitiesOnly yes and the key for that host in ~/.ssh/config.
Why it happens
If your SSH agent holds several keys, the client tries each one in turn. The server limits authentication attempts (often 5-6), so it disconnects before reaching the correct key — even though you have it.
Fix: offer only the right key
Tell SSH to use one specific key and not try the others:
ssh -o IdentitiesOnly=yes -i ~/.ssh/the_right_key user@serverMake it permanent
Add a host entry in ~/.ssh/config so it always uses the correct key:
Host myserver
HostName server-ip
User myuser
IdentityFile ~/.ssh/the_right_key
IdentitiesOnly yesIf you genuinely have the wrong/no key, use your provider's VNC/serial console to add your public key to ~/.ssh/authorized_keys — see our guide on SSH connection issues.
Too many keys offered, not a wrong password. Use IdentitiesOnly=yes with the right key, and set it in ~/.ssh/config.
Other situations that trigger this
- SSH agent forwarding through a jump host offers every key loaded on your local agent to the destination server, multiplying the attempt count fast.
- Working across several projects/servers, each with its own key, without ever clearing old ones from the agent (
ssh-add -lshows what's loaded). - A low
MaxAuthTrieson the server (if you control it) makes this trigger sooner than the SSH default — raising it slightly can help, but fixing the client side is the real solution.
How to prevent it going forward
- Clear unused keys from the agent with
ssh-add -Dand load only what you need for the session. - Use a distinct
Hostblock per server in~/.ssh/configwithIdentitiesOnly yesset for all of them, not just the problem one. - For hardened servers you administer, pair key-based login with fail2ban so repeated failures (legitimate or not) get rate-limited automatically.
Related errors
If SSH refuses the connection outright rather than failing auth, see fixing SSH connection refused. For a plain publickey rejection with just one key, see fixing "Permission denied (publickey)". To lock things down properly, see how to harden SSH.