Security

Why You Get "no matching host key type found": Moving from ssh-rsa to Ed25519

If you are still typing ssh-keygen -t rsa, this one is for you. OpenSSH has moved a fair bit over the last few years, and a runbook written before that shift may not connect at all today.

1. ssh-rsa Simply Won't Connect

SSH Neon Logo

Old RSA keys — more precisely the ssh-rsa signature algorithm — sign with SHA-1. SHA-1 collisions have been practical for years, and OpenSSH 8.8 (2021) turned it off by default.

Most people have hit this at least once:

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

Nothing broke on the server; your client stopped accepting it. -o HostKeyAlgorithms=+ssh-rsa will get you in, but it only gets you in — nothing about it is safer. The problem is the signature algorithm rather than the key size, so staying on RSA means both ends need rsa-sha2-256 or rsa-sha2-512.

2. When in Doubt, Ed25519

The 2048-vs-4096 argument is over. Use Ed25519.

ssh-keygen -t ed25519 -C "your-email@example.com"

The part I appreciate most is that there is no key size to pick. The public key fits on one line, which makes authorized_keys readable at a glance, and signing is quick — you won't feel the difference against RSA 4096 day to day, but you will in CI that authenticates a few hundred times an hour.

The exception is hardware too old to know about it. Embedded boxes and older network appliances still turn up.

3. FIDO2 Security Keys

Since OpenSSH 8.2, YubiKey-class FIDO2 devices work with no extra software.

ssh-keygen -t ed25519-sk

What lands on disk is a key handle — a reference. The private key never leaves the device. Lose the laptop or run malware on it, and an attacker still can't reach your servers while the token is in your pocket.

Tapping the key on every connection is a nuisance, but it also means a script can't quietly hop through a bastion on its own. The flip side is that these keys are a poor fit for cron jobs and CI.

Add -O resident and the key material lives on the device, so you can pull it onto another machine with ssh-keygen -K. That's the one to use if you move between computers.

4. Windows Has It Built In

Windows 10/11 ship with the OpenSSH client, so ssh works straight from PowerShell, and the server side is available as an optional feature. PuTTY is down to serial consoles and session management.

One gotcha: the OpenSSH Authentication Agent service is disabled by default, so ssh-agent has to be switched on by hand.

Where That Leaves You

Drop ssh-rsa and ssh-dss — DSA was removed from OpenSSH 10 outright. Use ed25519 for everyday keys, and move the machines you actually care about onto ed25519-sk. That covers it.