Received disconnect from x.x.x.x port 22:2: Too many authentication failuresが出た場合の対処

Linux関連の小ネタです。

sshを使ってサーバに接続しようとして、以下エラーが出てしまう場合、

Received disconnect from x.x.x.x port 22:2: Too many authentication failures

sshのオプションで「IdentitiesOnly=yes」を試してみると良いです!

$ ssh -o IdentitiesOnly=yes xxx@xx.xx.xx.xx

またセキュリティ的にグレーゾーンではありますが、「/etc/ssh/sshd_config」の「MaxAuthTries」を増やすのも手です。「ssh-add」で登録している鍵の数程度にすれば良いかと思います。

些細なことですがハマると意外と面倒なので小ネタとしてあげておきます。