| Tested on | RHEL 8.10 SSH server/client (article lab captures); Ubuntu 26.04 client (OpenSSH_10.2p1) against an isolated OpenSSH server; UBI8 container (openssh-server 8.0p1) for the classic reject + RSA-SHA2 success path |
|---|---|
| Package | Lab: openssh-server-8.0p1-25.el8_10.x86_64 / openssh-clients-8.0p1-25.el8_10.x86_64 (OpenSSH_8.0p1, OpenSSL 1.1.1k FIPS). Also checked on Ubuntu 26.04 OpenSSH 10.2p1 and UBI8 OpenSSH 8.0p1. |
| Applies to | Any OpenSSH server that rejects an RSA user-auth signature via PubkeyAcceptedKeyTypes or PubkeyAcceptedAlgorithms (Ubuntu, Debian, RHEL/Rocky/Alma/Fedora, cloud images, and similar). Client triggers include older OpenSSH defaults, older macOS/PuTTY/MobaXterm clients, and pre-0.75 PuTTY. |
| Privilege | sudo or root on the SSH server to inspect auth logs (/var/log/secure or /var/log/auth.log) and restart sshd when needed; normal admin access on the client for ssh -vvv |
| Scope | RSA public-key auth rejected against the server’s accepted signature list while rsa-sha2-256 / rsa-sha2-512 often remain allowed. The server log prints the key-object type (ssh-rsa for any RSA key), not a guaranteed copy of the refused signature. Does not cover host-key algorithm mismatches, SELinux authorized_keys denials, or password auth failures. |
| Related guides | SSH key authentication OpenSSH certificate authentication ssh command |
In this article we will fix the server log line userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedKeyTypes so public-key login works again. Newer OpenSSH prints the same reject with PubkeyAcceptedAlgorithms.
What the message means:
- An RSA authentication attempt used a signature algorithm that is not in the server’s accepted list
- In many cases that is the legacy SHA-1
ssh-rsasignature - On older OpenSSH builds the log text may only identify the RSA key type, not the exact algorithm offered
- Confirm the real algorithm with
ssh -vvv(signing using ...) before changing the server
Do not start by re-enabling SHA-1 on the server. First:
- Test whether the same RSA key works with
rsa-sha2-256orrsa-sha2-512 - Or switch to Ed25519
I reproduced the failure and those fixes on RHEL 8.10.
What Does userauth_pubkey key type ssh-rsa not in PubkeyAcceptedKeyTypes Mean?
userauth_pubkey is the SSH server step that checks your public key login. The rest of the line means an RSA signature the client offered is not in the server’s accepted list.
That name is easy to misread for two reasons.
First, ssh-rsa appears in two places:
Where you see ssh-rsa |
What it actually means |
|---|---|
First field of a line in authorized_keys |
The key type is RSA. That part is still normal and widely used. |
PubkeyAcceptedKeyTypes / PubkeyAcceptedAlgorithms |
The signature method is RSA with the old SHA-1 hash. Many modern policies disable that. |
Key takeaway from that table:
- Seeing
ssh-rsaat the start ofauthorized_keysdoes not mean the login must use SHA-1 - The same RSA key can authenticate with
rsa-sha2-256orrsa-sha2-512
Second, the log line prints the name from the key object, not a guaranteed copy of the algorithm the client just offered:
- On OpenSSH 8.0, any RSA key object’s type string is
ssh-rsa - I allowed only
ssh-rsaon the server while the client signed withrsa-sha2-512 - The server still logged
key type ssh-rsa not in PubkeyAcceptedKeyTypes - The rejected algorithm was
rsa-sha2-512; the printed name was stillssh-rsa
So treat the log as a starting diagnosis, not a full answer:
- An RSA signature was refused against the server’s accepted list
- The line alone does not prove which RSA signature name was refused
- Confirm with the client’s
signing using ...line (ssh -vvv) or the server’s effective acceptance list
The server is not saying “RSA keys are banned.” Ways the same key (or a new one) can still work:
- Client signs with
rsa-sha2-256orrsa-sha2-512 - Or you switch to an ed25519 key
Option naming:
- Newer OpenSSH:
PubkeyAcceptedAlgorithms - Older OpenSSH:
PubkeyAcceptedKeyTypes - The failure meaning is the same
Do not fix this by changing HostKeyAlgorithms:
- That setting is about verifying the server host key
- This error is about the signature used to authenticate the user
Permission denied (publickey,...) on the client is only a summary. On the server, open /var/log/secure, /var/log/auth.log, or journalctl -u sshd and look for userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedKeyTypes (or PubkeyAcceptedAlgorithms). Use that line as the starting diagnosis, then confirm the actual signature with ssh -vvv.
Quick Fix
| Situation | Best fix |
|---|---|
rsa-sha2-512 test succeeds |
Keep the existing RSA key and persist RSA-SHA2 |
| Modern client available | Upgrade or configure the client to use RSA-SHA2 |
| Legacy client cannot use RSA-SHA2 | Temporary ssh-rsa compatibility exception (non-FIPS only) |
| Config change appears ignored | Distro crypto-policy may override sshd_config (see below) |
| FIPS-required server | Do not enable SHA-1; use RSA-SHA2 or another allowed method |
PubkeyAcceptedKeyTypes +ssh-rsa (or PubkeyAcceptedAlgorithms +ssh-rsa) and restarting sshd. First test whether the same RSA key works with RSA-SHA2. If the server must stay FIPS-compliant, do not re-enable SHA-1 at all.
Confirm the Error in Server Logs
From the laptop or jump host, try SSH with your RSA private key. This command asks SSH to use only public-key authentication for this attempt, so a password prompt or Kerberos/GSSAPI path does not hide the key failure:
ssh -o PreferredAuthentications=publickey -o IdentitiesOnly=yes -i ~/.ssh/id_rsa root@203.0.113.10root@203.0.113.10: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).Permission denied with publickey in the list means key auth was tried and failed. The client still does not say why. Run a verbose attempt and keep the important debug lines:
ssh -vvv -o BatchMode=yes -o PreferredAuthentications=publickey \
-o IdentitiesOnly=yes -i ~/.ssh/id_rsa root@203.0.113.10 true 2>&1 \
| grep -E 'Offering|Server accepts|sign_and_send|Authentications that|Permission denied'debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Offering public key: /root/.ssh/id_rsa RSA SHA256:XPhBjLTON+Hs+nkHLQ4Fb5lwruWhXylCltVHvfJoaxo explicit
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
root@203.0.113.10: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).Here the client offered the RSA key, but you never see Server accepts key.
On the SSH server, search /var/log/secure or /var/log/auth.log (or journalctl -u sshd) for the algorithm reject. This lab uses /var/log/secure:
grep 'PubkeyAcceptedKeyTypes' /var/log/secureSep 22 12:27:58 ssh-server sshd[1340265]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedKeyTypes [preauth]
Sep 22 12:27:58 ssh-server sshd[1340265]: Connection closed by authenticating user root 203.0.113.20 port 58704 [preauth]
Sep 22 12:34:25 ssh-server sshd[1345155]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedKeyTypes [preauth]
Sep 22 12:34:47 ssh-server sshd[1345474]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedKeyTypes [preauth]
Sep 22 12:35:00 ssh-server sshd[1345614]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedKeyTypes [preauth]Those lines mean:
- An RSA public-key offer was rejected against the acceptance list
- The public key can already be in
authorized_keys - Confirm which signature the client used with
ssh -vvvin the next section
This lab used RHEL 8.10 OpenSSH 8.0p1 on both ends (OpenSSL 1.1.1k FIPS). Package checks were openssh-clients-8.0p1-25.el8_10.x86_64 and openssh-server-8.0p1-25.el8_10.x86_64.
Preferred Fix: Use rsa-sha2 with the Existing RSA Key
One RSA private key can prove who you are in more than one way:
| Algorithm name offered to sshd | Hash | Typical name in logs |
|---|---|---|
ssh-rsa |
SHA-1 | legacy RSA |
rsa-sha2-256 |
SHA-256 | modern RSA |
rsa-sha2-512 |
SHA-512 | modern RSA |
Force SHA-2 for one attempt, with no server edit:
ssh -vvv -o BatchMode=yes -o PreferredAuthentications=publickey \
-o IdentitiesOnly=yes -i ~/.ssh/id_rsa \
-o PubkeyAcceptedKeyTypes=rsa-sha2-512,rsa-sha2-256 \
root@203.0.113.10 'echo RSA_SHA2_OK' 2>&1 \
| grep -E 'Server accepts|sign_and_send|Authentication succeeded|RSA_SHA2'debug1: Server accepts key: /root/.ssh/id_rsa RSA SHA256:XPhBjLTON+Hs+nkHLQ4Fb5lwruWhXylCltVHvfJoaxo explicit
debug3: sign_and_send_pubkey: RSA SHA256:XPhBjLTON+Hs+nkHLQ4Fb5lwruWhXylCltVHvfJoaxo
debug3: sign_and_send_pubkey: signing using rsa-sha2-512
debug1: Authentication succeeded (publickey).
RSA_SHA2_OKIf this command succeeds:
- Your RSA key is fine
- The failure was the signature algorithm, not the key itself
- You do not need to enable
ssh-rsaon the server - Persist the RSA-SHA2 client setting or update the client, then stop here
Use -vvv, not -v. sign_and_send_pubkey: signing using is a debug3 line and disappears at -v.
For a normal login without dumping debug noise:
ssh -o PubkeyAcceptedKeyTypes=rsa-sha2-512,rsa-sha2-256 \
-i ~/.ssh/id_rsa root@203.0.113.10On newer OpenSSH clients the option is named PubkeyAcceptedAlgorithms.
Persist it for that host in ~/.ssh/config:
Host 203.0.113.10 ssh-server ssh-server.lab.example
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
PubkeyAcceptedKeyTypes rsa-sha2-512,rsa-sha2-256Client Host stanzas are covered in more depth in the ssh config guide.
If your log text is the older sshd: ssh-rsa algorithm is disabled warning instead of this PubkeyAcceptedKeyTypes reject, see sshd: ssh-rsa algorithm is disabled.
Why did the client choose ssh-rsa?
Older clients or vendor crypto-policy settings can cause an RSA key to use the legacy SHA-1 signature instead of RSA-SHA2. Do not guess from:
- The key filename
- The
authorized_keysfirst field
Run ssh -vvv and look for signing using .... In this test:
- The failing client showed
signing using ssh-rsa - Forcing RSA-SHA2 changed it to
signing using rsa-sha2-512 - Authentication succeeded
Alternative: Use an Ed25519 Key
You do not need to replace a healthy RSA key merely because ssh-rsa / SHA-1 is disabled:
- If RSA-SHA2 works, keeping the existing RSA key is often the least disruptive fix
- OpenSSH has supported RSA-SHA2 since 7.2
If the system must comply with FIPS requirements, verify which key algorithms are permitted by that environment; RSA-SHA2 is usually the less disruptive path for an existing RSA key.
If you prefer a new key type rather than tuning RSA signatures, use ed25519. Generate SSH keys covers key types and ssh-copy-id in more detail:
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N ''Install the public key on the server. RSA pubkey auth may still be broken at this point, so ssh-copy-id needs another working method for this step:
- Password auth was enabled on this lab server
- The earlier
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)line showspasswordwas still offered
ssh-copy-id -i ~/.ssh/id_ed25519.pub root@203.0.113.10Log in with the new key:
ssh -i ~/.ssh/id_ed25519 root@203.0.113.10ed25519 does not depend on the ssh-rsa versus rsa-sha2-* choice. In this lab, other admins already logged in with ED25519 while the RSA SHA-1 path was failing:
Sep 22 12:35:29 ssh-server sshd[1346013]: Accepted publickey for root from 203.0.113.30 port 34654 ssh2: ED25519 SHA256:DmBB6a5hDE8hSamuH0sCjp0B7q29B+TVWd0C1kDW2O8Accepted publickey with ED25519 means that path was already allowed on the same server that rejected ssh-rsa.
Legacy Clients That Only Support ssh-rsa
Use this only when a legacy client cannot speak rsa-sha2-* and you must keep that client working for a short time.
ssh-rsa is a compatibility compromise, not a security improvement. Prefer RSA-SHA2 or Ed25519 whenever the client can support them.
On a normal OpenSSH server (no vendor crypto-policy override), add a temporary drop-in and reload:
cat >/etc/ssh/sshd_config.d/99-allow-ssh-rsa.conf <<'EOF'
# Temporary: allow legacy ssh-rsa signatures (SHA-1). Prefer RSA-SHA2 when possible.
PubkeyAcceptedAlgorithms +ssh-rsa
EOFOn older OpenSSH that still uses the old option name:
cat >/etc/ssh/sshd_config.d/99-allow-ssh-rsa.conf <<'EOF'
PubkeyAcceptedKeyTypes +ssh-rsa
EOFCheck syntax:
sshd -tReload sshd so the drop-in takes effect:
systemctl reload sshdThen verify from the legacy client with ssh -vvv and look for signing using ssh-rsa plus a successful login. Remove the drop-in once the client can speak RSA-SHA2.
If this drop-in appears to do nothing, your distribution may be applying a system-wide crypto policy that overrides normal sshd_config. See the next section.
Why authorized_keys Can Say ssh-rsa and Still Work
Two different uses of the name ssh-rsa:
authorized_keyslines that start withssh-rsaidentify an RSA public key. That format is still valid.- The server reject names a signature algorithm. Modern OpenSSH often allows
rsa-sha2-256/rsa-sha2-512for that same key while disabling the SHA-1ssh-rsasignature.
Upstream OpenSSH framed the change the same way: existing RSA keys do not need replacing merely because SHA-1 signatures were turned off.
PubkeyAcceptedAlgorithms vs HostKeyAlgorithms
| Piece | Role |
|---|---|
authorized_keys |
Which public keys are trusted |
PubkeyAcceptedKeyTypes / PubkeyAcceptedAlgorithms |
Which signature algorithms sshd accepts for those keys |
HostKeyAlgorithms |
How the client verifies the server host key (different problem) |
Common traps:
- Assuming a missing key when the key is present and the signature algorithm is wrong
- Mixing
HostKeyAlgorithmswith user public-key auth algorithms - Reading the server log’s printed
ssh-rsaas proof of which signature the client offered - Starting with
+ssh-rsabefore testing RSA-SHA2
Authentication method knobs beyond algorithm lists are covered in OpenSSH authentication methods.
When sshd_config Changes Are Ignored
On most OpenSSH installs, setting PubkeyAcceptedAlgorithms (or PubkeyAcceptedKeyTypes) in sshd_config / sshd_config.d is enough.
On some distributions:
- A system-wide crypto-policy layer can override or replace that setting
- Inspect how your distribution applies crypto policy if a normal OpenSSH change appears ignored
- The rest of this section is the RHEL 8 example from this lab
| Environment | Why sshd_config may behave differently |
|---|---|
| Standard OpenSSH | PubkeyAcceptedAlgorithms / PubkeyAcceptedKeyTypes controls accepted user-auth signatures |
| RHEL 8 family | System crypto-policy may be injected into the sshd command line and override normal config |
| Newer RHEL family | Crypto-policy integration differs; inspect the effective config rather than assuming the RHEL 8 mechanism |
If +ssh-rsa does not work on RHEL crypto-policy systems
On RHEL 8, systemd often starts sshd as:
sshd -D $OPTIONS $CRYPTO_POLICYWhat that means in practice:
CRYPTO_POLICYcomes from/etc/crypto-policies/back-ends/opensshserver.config- It can set a full
-oPubkeyAcceptedKeyTypes=...list on the command line - That list wins over
/etc/ssh/sshd_config.d/
Also note how +ssh-rsa behaves:
PubkeyAcceptedKeyTypes +ssh-rsaappends to OpenSSH’s compiled-in defaults, not to the crypto-policy list- On OpenSSH 8.0 those defaults already ended with
ssh-rsa - So a
+ssh-rsadrop-in can be a complete no-op even when it is parsed
Prefer a supported crypto-policy override or subpolicy over editing generated backend files directly. After any policy change, verify the generated OpenSSH backend:
grep -E 'PubkeyAccepted(KeyTypes|Algorithms)' \
/etc/crypto-policies/back-ends/opensshserver.configOn RHEL 9+:
- Red Hat documents
update-crypto-policies --set DEFAULT:SHA1as the supported SHA-1 compatibility switch - That change is system-wide, not SSH-only
- For an SSH-only exception, use an application-specific OpenSSH path for that release
Check the live RHEL 8 sshd policy
Do not use pidof -s sshd. Use the service main PID:
MAINPID=$(systemctl show -p MainPID --value sshd)Read that process’s command line:
tr '\0' ' ' < /proc/"$MAINPID"/cmdline; echoBefore the legacy re-enable in this lab, the live -oPubkeyAcceptedKeyTypes= value included:
- ECDSA
- Ed25519
rsa-sha2-*- Not
ssh-rsa
You can also print the effective list the same way systemd would apply it:
( . /etc/crypto-policies/back-ends/opensshserver.config
sshd -T $CRYPTO_POLICY | grep -i pubkeyaccepted )Plain sshd -T on EL8:
- Can still show
ssh-rsafrom compiled-in defaults - While the live daemon rejects it
After a change, restart with systemctl.
Troubleshooting PubkeyAcceptedKeyTypes Rejects
| Problem | Likely cause | What to check |
|---|---|---|
key type ssh-rsa not in PubkeyAccepted... |
RSA signature not allowed | ssh -vvv → signing using |
rsa-sha2-512 works |
RSA key is fine; legacy algorithm was the issue | Persist RSA-SHA2 |
authorized_keys starts with ssh-rsa |
Normal RSA key format | Do not confuse key type with SHA-1 signature |
| Modern client works, old client fails | Old client lacks or does not negotiate RSA-SHA2 | Upgrade client, or temporary compatibility exception |
Changing HostKeyAlgorithms does nothing |
Wrong setting | Use PubkeyAcceptedAlgorithms / PubkeyAcceptedKeyTypes |
| Config change appears ignored | Vendor/system crypto policy may override it | Inspect distro integration (RHEL example above) |
| FIPS host, SHA-1 “fix” requested | Policy forbids SHA-1 | Do not re-enable ssh-rsa; update the client |
Useful generic checks:
ssh -vvv -o PreferredAuthentications=publickey -i ~/.ssh/id_rsa user@host true 2>&1 \
| grep 'signing using'A working modern path prints signing using rsa-sha2-512 or rsa-sha2-256. A legacy path prints signing using ssh-rsa.
On the server:
grep -E 'PubkeyAccepted|userauth_pubkey' /var/log/secure /var/log/auth.log 2>/dev/null | tail -20RHEL-specific follow-ups when a drop-in is ignored. Confirm how systemd starts sshd:
systemctl cat sshd | grep -E 'EnvironmentFile|ExecStart'Resolve the service main PID:
MAINPID=$(systemctl show -p MainPID --value sshd)Read that MainPID command line:
tr '\0' ' ' < /proc/"$MAINPID"/cmdline; echoSummary
What the error means:
- An RSA authentication attempt used a signature algorithm that is not in the server’s accepted list
- Confirm the real algorithm with
ssh -vvv(signing using ...) - Do not start by re-enabling SHA-1
Best fix order:
- Keep the RSA key and make the client use
rsa-sha2-512orrsa-sha2-256 - If that works, stop there
- Ed25519 is a good alternative if you want a new key type
- Re-enable SHA-1
ssh-rsaonly for short-lived legacy interoperability, and not on FIPS-required systems
On distributions that apply system-wide crypto policies:
- An
sshd_configchange may be overridden by the vendor policy layer - RHEL 8 is one example covered in this article
- If RSA-SHA2 already works from the client, you do not need to change the server policy at all
References
- sshd_config(5) — PubkeyAcceptedAlgorithms / PubkeyAcceptedKeyTypes — which public-key signature algorithms
sshdaccepts - OpenSSH release notes —
ssh-rsa/ SHA-1 deprecation history andrsa-sha2-* - RHEL: Using system-wide cryptographic policies — how crypto-policies can affect OpenSSH on RHEL
Frequently Asked Questions
What does "key type ssh-rsa not in PubkeyAcceptedKeyTypes" mean?
sshd rejected an RSA public-key signature that is not in its accepted list. In many cases that is legacy SHA-1 ssh-rsa, but on older OpenSSH the log can print the key-object type (always ssh-rsa for an RSA key) rather than the exact algorithm offered. Confirm with the client's signing using line (ssh -vvv). Prefer rsa-sha2-256 or rsa-sha2-512 with the same RSA key, or use ed25519.
Should I re-enable ssh-rsa first?
No. First force the client to use rsa-sha2-512 or rsa-sha2-256. If that succeeds, persist the client setting and stop. Re-enable ssh-rsa only when a legacy client cannot use RSA-SHA2, and not on FIPS-required systems.
Can I re-enable ssh-rsa on a RHEL FIPS system?
No, not if the host must remain compliant. Update the client or use an allowed RSA-SHA2 or Ed25519 path.
How can I work around this without changing the server?
Force SHA-2 RSA on the client: ssh -o PubkeyAcceptedKeyTypes=rsa-sha2-512,rsa-sha2-256 -i ~/.ssh/id_rsa user@host. On newer OpenSSH, use PubkeyAcceptedAlgorithms instead. Or generate and use an ed25519 key. Use ssh -vvv when you need the debug3 signing using line.
Is re-enabling ssh-rsa safe?
It restores compatibility with clients that still offer SHA-1 RSA signatures. Prefer rsa-sha2-* or ed25519 when you can. Do not re-enable SHA-1 on FIPS-required hosts.
What is the difference between ssh-rsa and rsa-sha2-512?
Both can use the same RSA key pair. ssh-rsa means the signature uses SHA-1. rsa-sha2-512 means the signature uses SHA-512. Seeing ssh-rsa in authorized_keys does not force SHA-1.
Does this affect ed25519 or ECDSA keys?
No. Those algorithms are separate entries in PubkeyAcceptedKeyTypes / PubkeyAcceptedAlgorithms. In this lab, an ED25519 login succeeded while RSA with ssh-rsa failed.
Why does my PubkeyAcceptedAlgorithms setting appear to be ignored?
Some distributions integrate OpenSSH with system-wide crypto-policy frameworks. On RHEL 8, for example, systemd can pass an algorithm list to sshd that overrides normal config files. Inspect how your distro applies crypto policy, and verify the live sshd settings before assuming a drop-in failed for some other reason.
Does HostKeyAlgorithms fix this error?
No. HostKeyAlgorithms is about verifying the server host key. This error is about the user authentication signature algorithm.

