Fix SSH "No Matching Host Key Type Found. Their Offer: ssh-rsa,ssh-dss"

Photo by Sora Shimazaki on Pexels
Based on the official docs for OpenSSH 10.6p2 (release notes checked November 2026) Hardware test not run How guides are made and checked

You try to SSH into an old switch, router, NAS or server and get this instead of a login prompt:

Unable to negotiate with 10.0.2.5 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

This guide explains what the error means, the safe way to fix it, and the quick workaround for a single device. It also covers the big change since this post was first written: OpenSSH 10.0 removed ssh-dss (DSA) completely, so if the device only offers ssh-dss, the old +ssh-dss trick no longer works on a current client.

Short on time? Paste your error into the SSH Legacy Host Config Generator and it gives you the exact ~/.ssh/config lines for that one device.

Understanding the Problem

When you connect, the server shows its host key so your client can check it is talking to the right machine. Each side lists the host key algorithms it supports, and they must agree on one.

The “Their offer” part of the error is the server’s list. Here it only offers two old algorithms:

  • ssh-rsa: an RSA key signed with SHA-1. OpenSSH 8.8 (2021) turned this off by default because SHA-1 is broken: the release notes say chosen-prefix collisions can be made for under USD 50K. Your RSA keys are still fine; modern servers use the same keys with the stronger rsa-sha2-256 and rsa-sha2-512 signatures. A server that only offers ssh-rsa is running an SSH server from before OpenSSH 7.2 (2016), or an equally old embedded one.
  • ssh-dss: DSA. OpenSSH 9.9 stopped building it by default, and OpenSSH 10.0 (April 2025) removed it entirely. There is no config option to turn it back on in a current client.

Your client refuses both by default, so the handshake fails before you ever get to a password or key prompt.

What’s Changed in OpenSSH Recently

The latest release is Portable OpenSSH 10.6p2 (5 November 2026). The changes that matter for this error:

OpenSSH versionChange
8.8 (2021)ssh-rsa (RSA with SHA-1) disabled by default. Can be re-enabled per host.
9.9 (September 2024)DSA disabled at build time by default.
10.0 (April 2025)DSA (ssh-dss) removed completely. sshd also drops the old diffie-hellman-group* key exchange from its defaults, and post-quantum mlkem768x25519-sha256 becomes the default key exchange.
10.1 (October 2025)The client warns when a connection uses a key exchange that isn’t post-quantum (the WarnWeakCrypto option).
10.6p2 (November 2026)Security fix for a password authentication bypass on some Linux builds without PAM (see “Keeping it safe” below).

To see what your own client supports, check its version and whether it still knows about DSA:

ssh -V
ssh -Q key | grep -E 'ssh-rsa|ssh-dss'

On OpenSSH 10.0 or later, ssh-dss won’t be in the list.

Let’s Get Started

Work through these in order. The first fixes the cause; the others are workarounds for a device you can’t update yet.

Solution 1: Updating the Server’s SSH Configuration

The safe fix is to give the server a modern host key so it stops offering only the old ones. If you can log in to it some other way (console, web interface, an older machine), this is the fix to aim for.

On a Linux server, generate any missing default host keys (RSA, ECDSA and Ed25519):

sudo ssh-keygen -A

Then make sure /etc/ssh/sshd_config (or a file in /etc/ssh/sshd_config.d/) loads a modern key, for example:

HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_ecdsa_key

Check the config before restarting, so a typo doesn’t lock you out:

sudo sshd -t
sudo systemctl restart ssh    # the service is called sshd on RHEL, Fedora and similar

Keep your current session open until a new connection works.

If the server is so old that its SSH server doesn’t support Ed25519 or ECDSA keys at all, the real fix is updating the operating system or firmware. For a switch, router or NAS, check the vendor’s site for a firmware update: newer firmware usually brings a newer SSH server.

Solution 2: Enabling Legacy Host Key Algorithms on the Client

If the server offers ssh-rsa and you need in now, allow it for this one connection:

ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa user@10.0.2.5
  • The + adds ssh-rsa to the defaults rather than replacing them, so a stronger algorithm is still used if the server supports one.
  • PubkeyAcceptedAlgorithms is only needed if you log in with a key. On clients older than OpenSSH 8.5 it is called PubkeyAcceptedKeyTypes.

What about ssh-dss? On OpenSSH 9.9 and earlier, -o HostKeyAlgorithms=+ssh-dss still works if your client was built with DSA. On OpenSSH 10.0 and later it can’t, because DSA is gone. Your options for a DSA-only device are:

  1. Update its firmware or operating system (Solution 1). This is the only real fix.
  2. Use its web interface or serial console to manage it in the meantime.
  3. Keep an older SSH client, built with DSA, just for that device, and don’t use it for anything else.

Solution 3: Configuring the SSH Client for Legacy Host Key Algorithms

If you connect to the same old device often, put the workaround in ~/.ssh/config so it applies to that host only:

Host old-switch
    HostName 10.0.2.5
    User admin
    HostKeyAlgorithms +ssh-rsa
    PubkeyAcceptedAlgorithms +ssh-rsa

Then connect with ssh old-switch. This is the same pattern the OpenSSH 8.8 release notes suggest for legacy hosts.

Don’t put these lines under Host *. That weakens every SSH connection you make, not just the one to the old device.

Troubleshooting

  • The next error is “no matching key exchange method found”. Very old servers also only offer old key exchange, such as diffie-hellman-group1-sha1. Add KexAlgorithms +diffie-hellman-group1-sha1 (use the name from the error’s “Their offer” list) to the same Host block. The option is KexAlgorithms; putting a key exchange name under HostKeyAlgorithms gives a “Bad key types” error.
  • Then “no matching cipher found”. Add Ciphers +aes128-cbc (again, use a name from “Their offer”). The config generator handles all three errors.
  • An error about ssh-dss being a bad or unsupported key type. Your client is OpenSSH 10.0 or later, or was built without DSA. See the options under Solution 2.
  • Host key works but your key login fails. Add PubkeyAcceptedAlgorithms +ssh-rsa (or PubkeyAcceptedKeyTypes on clients older than 8.5). Or log in with a password once and add a newer key type, if the device supports one.
  • A Host pattern doesn’t match. Host takes names and wildcards such as 192.168.1.*, not CIDR ranges like 192.168.1.0/24.

Prioritizing Security

These workarounds are for kit you can’t update yet, ideally on a trusted local network. Old algorithms are disabled for a reason.

  • Re-enable old algorithms per host only, never globally.
  • Plan to update or replace any device that only speaks ssh-rsa or ssh-dss. If its SSH server is that old, the rest of its firmware probably is too.
  • Keep your own SSH servers patched. OpenSSH 10.6p2 fixes a password authentication bypass (tracked as CVE-2026-123158) that affects some Linux systems built without PAM, such as small Alpine-based servers and containers. CISA has added it to its Known Exploited Vulnerabilities catalogue. Update to 10.6p2 or your distro’s patched package, and prefer key-only logins: our passwordless SSH guide shows how.

Wrapping Up

“No matching host key type found” means the server only offers host key algorithms your client no longer trusts. Give the server a modern host key if you can. If you can’t, allow ssh-rsa for that one host in ~/.ssh/config. And if the device only offers ssh-dss, a current OpenSSH client can’t talk to it at all, so a firmware update is the way forward.

You May Also Be Interested In

Sources

Updated 16 November 2026: rewritten for OpenSSH 10.x (ssh-dss can no longer be re-enabled), added PubkeyAcceptedAlgorithms, safer per-host config, troubleshooting for the follow-on errors and a note on the 10.6p2 security fix.