ssh always too many authentication failures

Add this in your ~/.ssh/config:

Host *
   IdentitiesOnly yes

source: How do I configure SSH so it dosen't try all the identity files automatically?


  1. You can set the preferred authentication method in the ~/.ssh/config file for the server(s) you are trying to access.

    Host <hostname>
    PreferredAuthentications password

  2. You can set the IdentityFile parameter for other servers you are connecting to in the ~/.ssh/config so you'll both connect to them more quickly and avoid the risk of too many failed authentication attempts.

    Host <hostname>
    IdentityFile ~/.ssh/my_key.pem

You can use the config file to set up aliases to your hosts as well, using the HostName parameter (and the host will be the nickname).
In the answers to the question you posted a link to, one of the parameters used is the IdentitiesOnly, which ignores the list in the ssh-agent.

You can use wildcards as well (mainly *) to work with all other servers, be sure to put the wildcard entry last and set the preferred authentication for the publickey hosts since ssh uses a first match algorithm.

man on ssh_config will show you the options you can use.