rescueshell Start trial

SSH "Too many authentication failures": what it means

The server stopped the login attempt because ssh had already tried several times without being accepted. If it ended there, the key you meant to use may never have been tried. That is different from a server that looked at your key and refused it.

This page describes standard OpenSSH behaviour. The commands are the usual ones, and wording differs between versions, distributions and platforms. We did not run them on your system for this page.

What the line looks like

The text the server sends is Too many authentication failures, with no full stop. The everyday place you meet it is a line from the machine you typed the command on. Current OpenSSH prints:

Received disconnect from HOST port PORT:CODE: Too many authentication failures

Older versions leave out the port:

Received disconnect from HOST:CODE: Too many authentication failures

HOST, PORT and CODE are filled in by ssh. The number after the port, or after the host in the older form, is a disconnect reason code, and it can differ, so this page does not list values. A made-up example:

Received disconnect from server.example.com port 22:2: Too many authentication failures

Which page is this?

1. Confirm the line and what was offered

Run the same command again with -v and read the whole output, not only the last line.

ssh -v user@server.example.com

Lines such as Offering public key: show each key ssh sent before the server stopped it. The ssh -v output reader can check a pasted log for this line, count and name the keys offered, and show a denial too if the log has one. It runs in your browser and sends nothing.

2. Rule out the cheap causes

The line does not say which key was meant or how many tries the server allows. These checks are cheap, and none of them is a diagnosis.

How many keys does the agent hold?

ssh-add -l

This lists the keys the agent holds, one line each. An agent with many keys means ssh may offer many before it reaches the one you meant. The "Check the agent" part of the publickey guide covers the agent and its two usual messages.

Is ssh offering more keys than you meant?

ssh can offer keys from the agent, from -i options, from IdentityFile lines and from the standard file names. If the offered list in the -v output is longer than you expected, a config entry or the agent is supplying the extras.

Offer only the key you name

The publickey guide shows how to make ssh offer only the key you name, with IdentitiesOnly and a named key file. See the "Point ssh at the right key" part of that page. We do not repeat it here. Behaviour differs between versions and platforms, and we did not run these checks on your system for this page.

3. Retry, and read what follows

After you change one thing, run the same command again. If the line goes away, that was the cause. If a different line follows, such as Permission denied (publickey), the server is now looking at the key you named and refusing it, and that page covers the account and the key on the device.

If the machine is a RescueShell device

A path that starts from the device can avoid a public SSH port. The agent on the device keeps an outbound HTTPS connection to our relay, so reaching a shell does not depend on an inbound port on the device. See SSH behind a firewall without port forwarding.

This line is about how many keys or tries were offered to the device's own SSH server, and the relay does not change that count. If a shell does not open once the agent is installed, see the shell does not open.

Try it on one device

The first device is free to try with no card, for 30 days from when it connects, not from when you sign up. Start a trial.