Skip to content
ecdsa.com
OpenSSH server (sshd) logSSH

Error message

userauth_pubkey: signature algorithm ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]

Also printed as

  • userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
  • userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedKeyTypes [preauth]
  • userauth_pubkey: signature algorithm ssh-ed25519 not in PubkeyAcceptedAlgorithms [preauth]

Wording by sshd release (checked in the OpenSSH sources): 9.0 and later "signature algorithm … not in PubkeyAcceptedAlgorithms"; 8.5–8.9 "key type … not in PubkeyAcceptedAlgorithms"; 8.4 and earlier "key type … not in PubkeyAcceptedKeyTypes" (the option was renamed in 8.5). The algorithm in the message varies with the client and the server's restriction.

OpenSSH server (sshd) log — the client sees only "Permission denied (publickey)."

What it means

The server's log explains a "Permission denied (publickey)": the client presented a signature algorithm the server does not accept. With `ssh-rsa` this is the SHA-1 based RSA signature scheme, disabled by default since OpenSSH 8.8 (2021). The RSA key itself is fine — the same key works with the `rsa-sha2-256`/`rsa-sha2-512` algorithms — but the client (an old OpenSSH, an outdated library or an embedded device) only knows the SHA-1 variant.

Why it happens

How to fix it

  1. 1.

    Use a modern key or a modern client

    An Ed25519 key avoids the RSA/SHA-1 problem completely; otherwise update the client library so it negotiates `rsa-sha2-*`.

    bash
    # Best: a modern key type, which every current client signs correctly
    ssh-keygen -t ed25519 -C "deploy@ci" -f ~/.ssh/deploy_ed25519
    # Or keep the RSA key and use a client that supports rsa-sha2-256/512
    # (OpenSSH >= 7.2, Paramiko >= 2.9, JSch fork 0.2.x, golang.org/x/crypto >= 2022, PuTTY >= 0.75)
  2. 2.

    Allow ssh-rsa narrowly, if you must

    A `Match` block for one legacy device keeps SHA-1 signatures away from everyone else. Treat it as temporary.

    text
    # /etc/ssh/sshd_config.d/legacy-device.conf - only for one legacy client, and remove it afterwards
    Match Address 10.0.5.17
        PubkeyAcceptedAlgorithms +ssh-rsa

Related errors

Browse the full signature error database