Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

SSH "no matching host key type found. Their offer: ssh-rsa": why OpenSSH 8.8 and later refuse an old server, and what to do

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

The full message reads Unable to negotiate with 203.0.113.20 port 22: no matching host key type found. Their offer: ssh-rsa. It means your OpenSSH client and the server could not agree on a host key signature algorithm. The server offers only ssh-rsa, which signs with SHA-1, and OpenSSH 8.8 and later no longer enable that by default. The lasting fix is on the server. A one-host exception on the client is a stopgap.

What the error means

When a client connects, each side sends lists of algorithms. The OpenSSH legacy options page says: "For a successful connection, there must be at least one mutually-supported choice for each parameter." The host key list is the one the server uses to prove its identity to the client, and the ssh_config keyword for it is HostKeyAlgorithms.

The text after Their offer: is the list sent by the other side. This wording comes from the OpenSSH source code (release V_10_6_P2), not from a manual page. The program builds the message from this format in packet.c: Unable to negotiate with %s: %s. Their offer: %s. The first %s is the remote host and port, the second is the error text, and the third is the other side's list of algorithms. The error text varies by the kind of algorithm that failed, and ssherr.c holds these forms: "no matching cipher found", "no matching MAC found", "no matching compression method found", "no matching key exchange method found" and "no matching host key type found".

The ssh-rsa name has a history that explains the message. The OpenSSH 8.8 release notes (2021-09-26) say: "This release disables RSA signatures using the SHA-1 hash algorithm by default." They also say that for most users "there is no need to replace ssh-rsa keys", because RSA keys can sign with rsa-sha2-256 and rsa-sha2-512, which OpenSSH has supported since release 7.2. The notes say incompatibility is more likely with older SSH implementations that "have not been upgraded or have not closely tracked improvements in the SSH protocol", and such a server may offer only the SHA-1 form. The same page lists release 7.0 (2015-08-11) as the one that disabled ssh-dss host keys by default, which gives the same message with Their offer: ssh-dss.

Likely causes

Cause What you see How to confirm
Old server software or an appliance that signs host keys only with ssh-rsa Their offer: ssh-rsa, client OpenSSH 8.8 or later ssh -G for the host shows a HostKeyAlgorithms line without ssh-rsa; the server's software is older or fixed
Server's HostKeyAlgorithms is restricted to ssh-rsa Same message although the server software is current On the server, sshd -T shows the effective host key algorithm list
Server has only a DSA host key Their offer: ssh-dss The legacy page describes this form; it is disabled by default from OpenSSH 7.0
Old client, newer server The Their offer: list names modern algorithms and the client cannot use any ssh -V shows an old client; the HostKeyAlgorithms line from ssh -G has nothing in common with the server's offer
Client configuration replaces the default list The error appears for one host or for all hosts ssh -G for that host shows the algorithm list actually used
Key exchange or cipher mismatch instead no matching key exchange method found or no matching cipher found The words after no matching name the parameter; the legacy page treats these separately

Prove the cause before changing anything

All of these are read-only.

1. Client version. The ssh manual says -V displays the version number:

ssh -V

2. What the client will actually accept for this host. The ssh manual says -G prints the configuration after the Host and Match blocks are evaluated. The legacy page says the output includes the chosen values for HostKeyAlgorithms:

ssh -G admin@old-host.example.com

Read the HostKeyAlgorithms line. The ssh_config manual's default list for that option has no ssh-rsa. A bad result for this fault is a line without ssh-rsa while the server offers only ssh-rsa. If the line shows something you did not expect, a configuration file is overriding the default.

3. What the build supports. The ssh_config manual says the list of available signature algorithms can be obtained with ssh -Q HostKeyAlgorithms. This lists what the build supports, which is not the same as what is enabled by default, so a name that appears here can still be refused:

ssh -Q HostKeyAlgorithms

Do not use this list to decide whether ssh-rsa is accepted; step 2 is the test.

For the override check in step 2, the ssh_config manual lists the order the files are read: command-line options, then ~/.ssh/config, then /etc/ssh/ssh_config, and the first value obtained for each directive is used.

4. The server side, if you manage it. The sshd manual says -V displays the version number and -T is extended test mode: it checks the configuration file and outputs the effective configuration:

sshd -V
sshd -T

The sshd_config manual lists the default HostKey files as /etc/ssh/ssh_host_ecdsa_key, /etc/ssh/ssh_host_ed25519_key, /etc/ssh/ssh_host_mldsa44_ed25519_key and /etc/ssh/ssh_host_rsa_key. A modern server offers more than ssh-rsa. If yours offers only ssh-rsa, look for a HostKeyAlgorithms line in its configuration, or for software too old to know the SHA-2 forms.

Fix

On the server (the lasting fix)

The OpenSSH 8.7 release notes say that if host key verification fails and no other supported host key types are available, "the server software on that host should be upgraded". The 8.8 notes recommend enabling RSA/SHA1 "only as a stopgap measure until legacy implementations can be upgraded or reconfigured with another key type (such as ECDSA or Ed25519)". The legacy page gives the same direction: upgrade the software at the other end or replace the weak key types with safer modern ones.

For an appliance or network device, that means a firmware or software update from its vendor. For an OpenSSH server you control, it means a newer OpenSSH, or a server configuration that offers an ECDSA or Ed25519 host key, or the rsa-sha2-* forms, through the HostKey and HostKeyAlgorithms directives in sshd_config. Changing sshd_config or restarting sshd on a server can lock you out of it, so keep a second session open and check the file with sshd -T, which the sshd manual describes as extended test mode, before any restart. The server steps themselves are not given here. A new host key has a new fingerprint, and every client that remembers the old one will warn about it, as covered in SFTP Host Key Changed: Verify It and Rotate Keys Safely.

On the client: connect once

The legacy page gives the form for one connection. Before it, compare the host's fingerprint with one you obtained through another route, such as the device's console, because a connection that accepts an unknown fingerprint cannot detect an impostor.

Risk: the next command lets this one connection accept a host key signed with the SHA-1 hash, which OpenSSH disabled because it is weak. The change applies to this command only.

ssh -o HostKeyAlgorithms=+ssh-rsa admin@old-host.example.com

The ssh_config manual says a + at the start of the list appends the algorithm to the default set instead of replacing it. No configuration file is changed, so no back-out is needed. If you accept a host key, ssh records it in your known-hosts file.

On the client: keep the exception for one host

The release notes give a stanza for a single destination host. The legacy page gives the matching form for HostKeyAlgorithms. Use the host key part only. The PubkeyAcceptedAlgorithms line in the release notes belongs to user authentication and is a different parameter.

First save the current file. If ~/.ssh/config does not exist yet, use the one-off command above instead:

cp -p ~/.ssh/config ~/.ssh/config.2026-11-22

Risk: the next edit re-enables SHA-1 host key signatures for the named host in every later connection. If you write the host name too broadly, or use Host *, it applies to hosts you meant to protect.

The ssh_config manual says the first value obtained is used, so host-specific blocks go near the beginning of the file. Add this block at the top:

Host old-host.example.com
    HostKeyAlgorithms +ssh-rsa

Check what the client will now use:

ssh -G admin@old-host.example.com

To undo it: put the saved file back, then check it.

cp -p ~/.ssh/config.2026-11-22 ~/.ssh/config
ssh -G admin@old-host.example.com

The legacy page notes that because the algorithm is appended, the client moves to a stronger algorithm automatically once the server supports one.

If the words after "no matching" are not "host key type"

no matching key exchange method found is handled through KexAlgorithms, no matching cipher found through Ciphers, and no matching MAC found through MACs. The legacy page shows a one-off command and a ~/.ssh/config stanza for KexAlgorithms (with diffie-hellman-group1-sha1) and for HostKeyAlgorithms. For Ciphers and MACs it only says you "might find" those options "useful for enabling" the other parameters. Each of these re-enables something OpenSSH disabled for being weak, and no changing steps for them are given here.

Example (illustrative): an engineer on a workstation with OpenSSH 9.x connects to old-host.example.com (203.0.113.20), a storage appliance with old firmware. The error is Unable to negotiate with 203.0.113.20 port 22: no matching host key type found. Their offer: ssh-rsa. ssh -G admin@old-host.example.com shows a hostkeyalgorithms line that lists rsa-sha2-512 and rsa-sha2-256 and no ssh-rsa, and no override in any configuration file. The engineer checks the fingerprint on the appliance console, saves ~/.ssh/config, adds the Host old-host.example.com block with HostKeyAlgorithms +ssh-rsa, connects, and raises a firmware update with the vendor. After the update the block is removed by restoring the saved file.

Confirm the fix

  1. ssh admin@old-host.example.com connects, and the fingerprint matches the one you checked.
  2. ssh -G for a different host does not show ssh-rsa added, so the exception is limited to one host.
  3. After a server upgrade, the connection works without the exception, and ssh -G for the host shows the default list.

What to watch afterwards

  • Keep a list of every host that needs the exception, and an owner and date for its upgrade.
  • If key login fails after the host key problem is solved, the server may also accept only ssh-rsa for user authentication. That is a different parameter; see SSH "Permission denied (publickey)": what the server log says and what to fix.
  • Remove the stanza when the server is upgraded.

Risks and limits

  • These commands have not been run or lab-tested.
  • Re-enabling ssh-rsa is a security trade-off the OpenSSH project advises against except as a stopgap. The release notes describe chosen-prefix attacks on SHA-1.
  • The message wording is from OpenSSH. Other SSH clients and servers use their own text for the same condition.
  • Version pages for ssh_config and sshd are the current OpenBSD manual pages. Check them against the version installed on your hosts.

Sources

  • OpenSSH: Legacy Options — OpenSSH project, no date shown, accessed 22 November 2026
  • OpenSSH: Release Notes — OpenSSH project, release entries dated individually (8.8 on 2021-09-26, 8.7 on 2021-08-20, 7.0 on 2015-08-11), accessed 22 November 2026
  • packet.c, tag V_10_6_P2 — OpenSSH portable source code, fixed tag V_10_6_P2, no date shown, accessed 22 November 2026
  • ssherr.c, tag V_10_6_P2 — OpenSSH portable source code, fixed tag V_10_6_P2, no date shown, accessed 22 November 2026
  • ssh_config(5) — OpenBSD manual page, 30 October 2026, accessed 22 November 2026
  • ssh(1) — OpenBSD manual page, 2 November 2026, accessed 22 November 2026
  • sshd(8) — OpenBSD manual page, 2 September 2026, accessed 22 November 2026
  • sshd_config(5) — OpenBSD manual page, 30 October 2026, accessed 22 November 2026
  • cp(1) — GNU coreutils 9.11 manual page, April 2026, accessed 22 November 2026