Solving SSH error: Too many authentication failures for

You may encounter the following error when you try to remotely login to a machine using ssh.

Received disconnect from xxx.xxx.xxx.xxx: 2: Too many authentication failures for username

The reason behind this is that your ssh-agent is offering multiple keys to the server. T To see what is happening under the hood, type

ssh -v username@hostname

To solve this issue, create or edit your “~/.ssh/config” file with the following content


HOST the_hostname.the_domain_name
IdentityFile ~/.ssh/your_particular_key
IdentitiesOnly yes
Port 22

To have ssh use only the your_particular_key for all hosts under the same domain, you can replace the first line with “HOST *.the_domain_name”. Enjoy!

Advertisements

2 Comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s