Skip to content
ecdsa.com
OpenSSH client (8.8+) connecting to a server that only offers legacy host key algorithmsSSH

Error message

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

Also printed as

  • no matching host key type found. Their offer: ssh-rsa,ssh-dss
  • Unable to negotiate with 127.0.0.1 port 22: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1

Host and port, and the server's offer, vary. For key exchange the text reads "no matching key exchange method found", for ciphers "no matching cipher found".

What it means

Client and server share no host key algorithm, so the connection stops during algorithm negotiation — before host verification or login. "Their offer" lists what the server proposed. `ssh-rsa` (RSA with SHA-1) and `ssh-dss` (DSA) are disabled by default in OpenSSH 8.8 and later; servers that offer nothing else are typically old appliances, routers, NAS boxes or unpatched systems. The key exchange variant ("no matching key exchange method found") has the same shape and the same remedies.

Why it happens

How to fix it

  1. 1.

    Allow the legacy algorithm for that host only

    A `Host` block keeps SHA-1 limited to the device that needs it. Never put `+ssh-rsa` under `Host *`.

    text
    # ~/.ssh/config - re-enable the legacy algorithm for that one device only
    Host old-switch.lan
      HostKeyAlgorithms +ssh-rsa
      PubkeyAcceptedAlgorithms +ssh-rsa
  2. 2.

    Give the server modern host keys

    Updating the device's firmware or OpenSSH and generating Ed25519/ECDSA host keys removes the need for exceptions.

    bash
    # On the server: generate modern host keys and let sshd offer them
    ssh-keygen -A                                   # creates missing ed25519/ecdsa host keys
    sshd -T | grep -E "^hostkeyalgorithms|^hostkey "  # what the server will offer

Related errors

Browse the full signature error database