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
An old embedded SSH server
commonSwitches, firewalls, printers and storage devices often run dropbear or old OpenSSH versions with RSA/SHA-1 host keys only.
A server without modern host keys
occasionalSystems installed long ago may have only an RSA host key and an sshd too old to sign with `rsa-sha2-256/512`.
A restricted client configuration
occasionalA `HostKeyAlgorithms` line in `~/.ssh/config` or `/etc/ssh/ssh_config.d` that lists only Ed25519 rejects servers that have ECDSA or RSA keys only.
How to fix it
- 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.
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