Strovent SystemsSign in
Reference

SSH "sign_and_send_pubkey: no mutual signature supported"

sign_and_send_pubkey: no mutual signature supported means an old SSH server only checks SHA-1 ssh-rsa signatures. Use Ed25519 or allow ssh-rsa for that host.

sign_and_send_pubkey: no mutual signature supported
[email protected]: Permission denied (publickey).

The key file loaded fine. The problem is the signature: to log in with a key, the client signs a challenge, and both sides must accept the same signature algorithm. Here they share none, so the client gives up on that key and moves on. With ssh -v the same thing shows as send_pubkey_test: no mutual signature algorithm.

Why it happens with RSA keys

An RSA key can sign in three ways:

  • ssh-rsa, with the SHA-1 hash, the original method
  • rsa-sha2-256 and rsa-sha2-512, with SHA-2 (RFC 8332)

A server tells the client which of these it accepts with the server-sig-algs extension (RFC 8308). OpenSSH servers have supported the SHA-2 methods since version 7.2.

An older server, or a device with an old SSH library, sends no such list. The client can then only use ssh-rsa. OpenSSH 8.8 (2021) removed ssh-rsa from the client's default PubkeyAcceptedAlgorithms because SHA-1 is broken, so a current client has nothing left to offer for that key.

The key itself is fine. The same RSA key still works on any server that speaks SHA-2.

Confirm it

ssh -v [email protected]

Look for the line with remote software version. A version of OpenSSH older than 7.2, or an unfamiliar embedded SSH server, points to this cause. Then try once with SHA-1 allowed:

ssh -o PubkeyAcceptedAlgorithms=+ssh-rsa [email protected]

If that logs in, you have found the cause.

Fixes, best first

  • Use an Ed25519 key on that server. Ed25519 has its own signature method with no SHA-1 variant. OpenSSH servers accept it from version 6.5. ECDSA keys also avoid the problem.
  • Upgrade the server's SSH software, if you control it. From OpenSSH 7.2 it signs and verifies with SHA-2 on its own.
  • Allow ssh-rsa for that one host only. OpenSSH calls this a stopgap. In ~/.ssh/config:
Host old-host
    HostName 192.0.2.10
    PubkeyAcceptedAlgorithms +ssh-rsa

The + adds ssh-rsa to the default list instead of replacing it. Do not put this under Host *. Clients older than OpenSSH 8.5 call the option PubkeyAcceptedKeyTypes.

If the same server also has only an RSA host key, the connection stops earlier with no matching host key type found. That needs HostKeyAlgorithms +ssh-rsa as well: see SSH "no matching key exchange method" and "no matching host key type" errors.

Other keys

The same message appears for any key whose type is not in the client's PubkeyAcceptedAlgorithms, for example an old DSA (ssh-dss) key, which OpenSSH has refused by default since version 7.0. Replace such a key with Ed25519.

The reverse case

A current server can refuse an old client that offers only ssh-rsa. The client then shows only Permission denied (publickey), and the reason is in the server's log. The fix is the same: a newer client, or an Ed25519 key.

Sources

Spotted a mistake? Email [email protected].