Migration guide
Check and enable post-quantum key exchange in OpenSSH
See which key-exchange algorithms your OpenSSH client and server offer, confirm a post-quantum hybrid (mlkem768x25519-sha256 or sntrup761x25519-sha512) is available and first in order, and enable it if it is not.
Documentation only
How this guide was validated. Drafted mainly from the cited sources. Run locally on 2026-12-04, read-only: ssh -V (OpenSSH_10.5p1, LibreSSL 3.3.6), ssh -Q kex (lists mlkem768x25519-sha256, mlkem768nistp256-sha256, sntrup761x25519-sha512 and sntrup761x25519-sha512@openssh.com), ssh -G localhost (default kexalgorithms begins mlkem768x25519-sha256,sntrup761x25519-sha512,...), and a strings search of /usr/bin/ssh confirming the client warning text. Not run: a real SSH handshake (no sshd was started, since that would need a host key on disk), sshd -T, and any server-side change. Version history is from OpenSSH pages, not tested.
Applies to
- OpenSSH 9.0 or later (sntrup761x25519-sha512), 9.9 or later (mlkem768x25519-sha256 available), 10.0 or later (mlkem768x25519-sha256 default)
- Lab-read on OpenSSH_10.5p1 (macOS, LibreSSL 3.3.6)
Before you start
- Shell access to the client machine. For the server, root or sudo and a way to reach the host if sshd fails to restart (console access).
- A second session kept open while you change sshd configuration.
Steps
- Check your OpenSSH client version and supported algorithms
The client lists what it supports.ssh -V ssh -Q kex - Check the client's effective preference order
ssh -G prints the configuration the client would use for a host, including defaults and anything in your ssh_config.ssh -G example.com | grep -i "^kexalgorithms" - Check the server's effective configuration
sshd -T checks the configuration file and prints the effective configuration (documented in the sshd man page). Run it as root on the server.sudo sshd -T | grep -i "^kexalgorithms" - Enable it on the server if missing
In /etc/ssh/sshd_config, use the ^ prefix to move algorithms to the head of the default list. The man page documents + (append), - (remove) and ^ (put at head). Avoid replacing the whole list: a short custom list can lock out clients. Keep this change small.KexAlgorithms ^mlkem768x25519-sha256,sntrup761x25519-sha512 - Test the configuration, then reload
-t checks the configuration file and keys. Reload with the method your system uses, and keep your existing session open until a new session works. The reload command depends on the system (for example systemctl reload sshd or systemctl reload ssh).sudo sshd -t
Verify
- Open a new connection with verbose output
The OpenSSH client prints the chosen algorithm at debug level.ssh -v user@host.example.com exit 2>&1 | grep -i "kex: algorithm" - Look for the client warning
OpenSSH 10.1 and later warn when a non-post-quantum algorithm is negotiated. The text exists in the local client binary. If you see it, the connection used a classical key exchange.
Roll back
- Restore the previous sshd_config
Remove the KexAlgorithms line you added (or restore your saved copy), test, and reload. Keep an existing session open while you do it.sudo sshd -t
What this guide does not cover
- This covers key exchange only, which protects recorded sessions from later decryption. It does not make host keys, user keys or signatures post-quantum. OpenSSH states that it will add post-quantum signature algorithms in future.
- A key-exchange result says nothing about authentication: the certificate and its signature are a separate question, and certificate signatures are not made post-quantum by this change.
- Both ends must support the algorithm. If either side lacks it, they negotiate a classical one.
- Only the ssh and sshd programs are covered. Tools that use their own SSH library (some Git hosting clients, file-transfer tools, appliances) are separate.
- sshd, sshd -T and the actual handshake were not run here, so the exact verification output is unconfirmed.
- sntrup761 and mlkem768 hybrids are listed together as post-quantum by OpenSSH. This guide does not rank them.