SSH returns “too many authentication failures” error – HostGator

I am an avid fan of using HostGator for small business WordPress website hosting. I love that they use a standard CPanel installation and I can get SSH access, it’s quick and easy – a diet VPS/dedicated server if you will.

I have been having an issue I’ve never seen before, when attempting to connect, e.g.:

ssh -p 2222 username@12.34.56.78

I was receiving the following error:

Received disconnect from 12.34.56.78: 2: Too many authentication failures for username

Why I Got This Too Many Authentication Failures Error

Recently, I started working on a large project that involved two big brands, in working with their dev team, I started using Git (which I love now) and authenticating with SSH keys.

After a few hours back and forth with support, troubleshooting IP blacklists and user errors, we realized it was key conflict that was troubling things. I temporarily moved these keys out of the~/.ssh/ directory and I was okay – until I reset them and they were stored in my OS X keychain.

Even moving them or deleting them did nothing. I also want to keep these keys intact because I use them to authenticate with Git and some of my project servers.

How I Fixed It

Thanks to this answer on superuser.com, I realized there’s a nice little flag for options I can send:-o PubkeyAuthentication=no.

By using this flag, I can have the connection disregard public key authentication all together and allow me to go straight to user/pass login. The final command:

ssh -p 2222 -o PubkeyAuthentication=no username@12.34.56.78

Note: the -p 2222 is only required for HostGator in this case, as SSH is restricted to port 2222. Feel free to remove or modify the port flag to your liking – I hope this helps you!

原文地址:https://www.cnblogs.com/fatt/p/5121080.html