rescueshell Start trial

SSH "signing failed" and "Agent admitted failure to sign"

ssh reached the server and was offering a key. To use it, ssh needed a signature made with that key, and it did not get one. So that key was not used. The line comes from the machine you typed the command on, and it does not say why the signature failed.

This page describes standard OpenSSH behaviour. The commands are the usual ones, and wording, the reason at the end of the line and which form you see differ between versions, distributions and platforms. We did not run them on your system for this page.

What the line looks like

Current OpenSSH prints one of these two forms, depending on whether the key came from an agent or not:

sign_and_send_pubkey: signing failed for TYPE "PATH" from agent: REASON
sign_and_send_pubkey: signing failed for TYPE "PATH": REASON

TYPE and PATH are filled in by ssh. A made-up example, with a reason OpenSSH can print:

sign_and_send_pubkey: signing failed for ED25519 "/home/you/.ssh/id_ed25519" from agent: agent refused operation

from agent means ssh got the key from an agent. Without it, the key did not come from the agent. The name in quotes is the one ssh holds for the key. It is often a file path, and for a key held by an agent it can be the label the agent gave it. The reason at the end of the line is a system or ssh message. agent refused operation and communication with agent failed are two that OpenSSH uses, and others are possible, so this page does not list them.

Older versions printed a different line for the same kind of failure:

Agent admitted failure to sign using the key.

As far as we know, current OpenSSH no longer prints that wording, so you are likelier to meet it on an older system. Which one you see depends on your version, and a line you find in an old forum post may be the older form of the one on your screen. This page treats both the same way.

A failed signature does not always end the login. ssh may go on to offer other keys, from the agent or from files, and the login can still succeed. If it does not, the last line you see is usually Permission denied (publickey), and the signing line is a clue to why the key you meant was never accepted.

Which page is this?

Several agent and key lines sound alike, so check the text. This page is for the signing line.

1. Confirm the line and where the key came from

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

ssh -v user@server.example.com

The ssh -v output reader can check a pasted log for either form of the line. It runs in your browser and sends nothing. Note which form you have, and whether the current line says from agent. That tells you whether to look at the agent first or at a key file.

2. Rule out the cheap causes

The line does not say why. An agent that could not sign, a problem with a hardware token or a key file, and a failure to talk to the agent at all can all look alike. These checks are cheap, and none of them is a diagnosis.

Is the key loaded in an agent you can reach?

ssh-add -l

This lists the keys the agent holds, one line each. If it prints the key you meant, the agent has it. If it says the agent has no identities or cannot connect, that is a different case and the publickey guide covers it. It is also worth asking whether the agent this shell talks to is the one you think it is. An agent started in another session, or one that has since ended, is not the same as the one that holds your key. How that is wired differs between systems, so check the manual page on yours.

Is it the key you meant?

If the current line names a path, compare it with the key you meant to use. A key can be offered because of a -i option, an IdentityFile line in ~/.ssh/config, or because the agent holds it. If the name is not one you expected, a config entry or the agent may be supplying it. The publickey guide shows how to make ssh offer only the key you name.

If the key is on a token or protected by a passphrase

A key that lives on a hardware token needs the token to be present and unlocked, and a key file with a passphrase needs the right one. If you have a Load key line next to this one, see the passphrase guide. Behaviour here 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 signing line goes away, that was the cause. If login still fails, the next message is the real one to read, and it is often Permission denied (publickey), which 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 a signature on the machine running ssh that was not made. The relay does not sign keys or load them into an agent, so it does not fix this line, and the session still ends at the device's own SSH server. 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.