SSHexit code > 0

Received disconnect: Too many authentication failures

$Received disconnect from 1.2.3.4 port 22: 2: Too many authentication failures

Analysis

The server disconnected you because your client attempted to authenticate too many times (usually with many different keys from an agent).

Common Triggers

  • SSH agent is offering too many keys that the server doesn't recognize.
  • Multiple failed password attempts.

Debug Checks

  • $Run ssh-add -l to see how many keys are in your agent.
  • $Use ssh -v to see which keys are being tried.

Resolution

1
Force a specific key: ssh -o IdentitiesOnly=yes -i ~/.ssh/id_rsa user@host.
2
Clear keys from agent: ssh-add -D.