Choosing strong SSH algorithms
Every SSH session negotiates three algorithm classes during the handshake: a
symmetric cipher for the data stream, a MAC for integrity (unless an AEAD
cipher provides it), and a key-exchange (KEX) algorithm to agree the session
keys. This reference lists the common OpenSSH options in each class with a
security status so you can harden sshd_config and your client config.
How it works
SSH negotiation is preference-ordered: the client offers a list, the server picks the first mutually supported entry. You control the offered lists with three directives:
Ciphers [email protected],[email protected],[email protected]
MACs [email protected],[email protected]
KexAlgorithms [email protected],curve25519-sha256
AEAD ciphers such as [email protected] and the aes*-gcm suites
authenticate and encrypt in one pass, so a separate MAC is not used. For CTR
ciphers, pair them with an encrypt-then-MAC (-etm) HMAC. Run ssh -Q cipher,
ssh -Q mac and ssh -Q kex to see what your local build supports.
Tips and notes
- Lead each list with the strongest algorithm — negotiation picks the first match.
- Avoid SHA-1 and MD5 MACs and any CBC or 3DES cipher; they are broken or weak.
- The
-etm(encrypt-then-MAC) HMACs are preferred over their plain counterparts. - After editing, validate with
sshd -tand reload before closing your session.