# Post-quantum SSH: enable mlkem768x25519-sha256 in minutes

URL: https://postquantumplan.com/en/blog/post-quantum-ssh
Published: 2026-12-03

> How to check and enable post-quantum key exchange in OpenSSH: which versions support mlkem768x25519-sha256, exact KexAlgorithms lines, and how to verify it.

To get post-quantum SSH, run OpenSSH 9.9 or later and make sure `mlkem768x25519-sha256` is in your `KexAlgorithms` list. From OpenSSH 10.0 it is the default, so on a current system the work is usually to check that nobody pinned an old classical-only list. OpenSSH has had a post-quantum hybrid, `sntrup761x25519-sha512`, as the default since 9.0, so even older servers may already be protected. This takes about ten minutes plus a staged rollout.

## What is protected, and what is not

SSH sessions carry commands, secrets and file transfers. A recorded session whose key exchange used classical elliptic curves can be decrypted later by a quantum computer: [harvest now, decrypt later](https://postquantumplan.com/en/learn/harvest-now-decrypt-later). The hybrid key exchange fixes that. It combines X25519 with a post-quantum KEM, so the session stays safe if either one holds.

SSH host keys and user keys (Ed25519, RSA, ECDSA) are signatures. They are not harvestable; forging one needs a quantum computer at connection time. OpenSSH has no standardized post-quantum signature key type that we could verify, so those stay classical for now. The urgent piece is the key exchange.

## What the release notes say

From the [OpenSSH release notes](https://www.openssh.org/releasenotes.html):

| Version | Change |
|---|---|
| 9.0 (April 2022) | Hybrid Streamlined NTRU Prime and x25519, `sntrup761x25519-sha512@openssh.com`, used by default |
| 9.9 (September 2024) | New hybrid ML-KEM and X25519: `mlkem768x25519-sha256` "is available by default" |
| 10.0 | "the hybrid post-quantum algorithm mlkem768x25519-sha256 is now used by default for key agreement" |

`mlkem768x25519-sha256` is the NIST-standardized ML-KEM-768 combined with X25519. `sntrup761x25519-sha512` is a non-NIST lattice hybrid with a long deployment history. Either is better than classical-only.

## Step 1: check your client

```bash
ssh -V
ssh -Q kex | grep -E "mlkem|sntrup"
```

On our test machine (OpenSSH 10.2p1) this lists `sntrup761x25519-sha512`, `sntrup761x25519-sha512@openssh.com` and `mlkem768x25519-sha256` (tested). If the grep returns nothing, upgrade.

![Terminal showing ssh -V reporting OpenSSH 10.2p1, then ssh -Q kex filtered to three algorithms, with mlkem768x25519-sha256 highlighted.](https://postquantumplan.com/images/terminal/openssh-kex-list.webp)

*Output of the two commands above on our test machine. (our own capture, OpenSSH 10.2p1)*

See the effective list and its order for a given host, including anything in your config files:

```bash
ssh -G example.com | grep -i "^kexalgorithms"
```

Order matters. On the same test machine, the effective default list put `ecdh-sha2-nistp256` first, with the ML-KEM hybrid second (tested). The client offers algorithms in order and the server picks the first one it also supports in the client's order, so a classical entry at the front can win. Inspect the list instead of assuming.

## Step 2: check what a server negotiates

```bash
ssh -vv user@server.example 2>&1 | grep "kex: algorithm"
```

The line shows the algorithm chosen, for example `kex: algorithm: mlkem768x25519-sha256`. We tested the client side. We did not test the success path against a remote server here, so run it against a system you own.

## Step 3: set it explicitly where you must

If you have no pin in `sshd_config` or `ssh_config`, a current OpenSSH needs no change. If you do pin, or are on 9.9, set a list with the hybrids first (client capability tested; server-side behaviour untested):

```text
# /etc/ssh/sshd_config
KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512,curve25519-sha256
```

```text
# ~/.ssh/config
Host *
    KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512,curve25519-sha256
```

Keep `curve25519-sha256` last only while old clients need it. Once every client supports a hybrid, remove it to enforce post-quantum exchange. A smoother way to stay current is to add and remove entries relative to the defaults using the `+` and `-` prefixes, for example `KexAlgorithms -curve25519-sha256`. Test this on one host first.

Validate and reload without dropping your session:

```bash
sudo sshd -t && sudo systemctl reload sshd
```

Keep a second session open while you test a new login. A syntax error that stops sshd from reloading is how people lock themselves out.

## What to watch for

- **Old clients and network devices.** Embedded devices, older Java SSH libraries and some appliances only speak classical key exchange. If you remove the classical fallback they will stop connecting. Inventory before enforcing.
- **Jump hosts and bastions.** Each hop negotiates its own exchange. Protecting the first hop does not protect the second.
- **Managed services.** Git hosting, file transfer and cloud shells set their own server policy. Ask the provider.
- **Automation.** CI systems often pin `KexAlgorithms` copied from a hardening guide years ago. Search your configuration management for it.

## Rolling it out across a fleet

1. **Upgrade first, configure second.** On OpenSSH 10.0 or later with no pins, you are done once the package is current. Find the hosts that are not: `ssh -V` through your configuration management gives a version inventory in minutes.
2. **Canary.** Change `KexAlgorithms` on a handful of non-critical hosts and connect from every client type you operate: laptops, CI runners, backup agents, monitoring, deployment tools. Look for `no matching key exchange method found` in client output and in the server log.
3. **Widen in rings.** Internal hosts, then bastions, then production. Keep the classical fallback until the failure rate has been zero for a few weeks.
4. **Enforce last.** Removing `curve25519-sha256` is the step that blocks old clients. Announce it, give a date, and have a documented exception path for the few devices that cannot upgrade; isolate those rather than leaving the whole fleet on the weaker list.
5. **Keep evidence.** Save the `ssh -G` output and a sample `kex: algorithm` line per host class. It is the proof you will want when an auditor or a customer asks.

## Troubleshooting

- **`no matching key exchange method found`.** The client and server share no algorithm. Run `ssh -Q kex` on both sides and compare; the older side needs an upgrade or the classical fallback.
- **The hybrid is listed but not chosen.** Check the order with `ssh -G host`. A classical entry earlier in the list can win, as it did on our test machine.
- **Config change has no effect.** `Match` blocks and included files in `ssh_config` or `sshd_config` can override a global line. Use `sudo sshd -T | grep -i kexalgorithms` on the server to see the effective value.
- **Hangs during key exchange.** Rare, usually a middlebox mishandling larger packets. Test from a different network path before blaming OpenSSH.

## Next steps

Find where classical-only lists are pinned in your repositories with the [code scanner](https://postquantumplan.com/en/lab/code-scanner) (see [finding quantum-vulnerable crypto](https://postquantumplan.com/en/blog/find-quantum-vulnerable-crypto)), and see the same pattern for web traffic in [enable post-quantum TLS](https://postquantumplan.com/en/blog/enable-post-quantum-tls). Explore how a KEM works in the [KEM playground](https://postquantumplan.com/en/lab/kem-playground). If you want help auditing SSH across a fleet, you can contact a specialist via [/en/contact](https://postquantumplan.com/en/contact).
