How to fix fatal: no matching cipher found in SSH

SSHINTERMEDIATEMEDIUMUpdated Jan 4, 2026ยท 218 views

SSH client and server have incompatible encryption algorithms (ciphers). Modern SSH clients disable weak legacy ciphers by default, causing connections to older servers to fail. Fix by enabling legacy ciphers in your client configuration.

Quick fix

Fixes fatal: no matching cipher found

ssh -Q cipher
  1. Check what ciphers the server offers
  2. Use the -c flag for a one-time connection
  3. Edit your SSH config for persistent settings
  4. Verify the configuration works
ssh โ€” error
ssh -Q cipher
fatal: no matching cipher found

What this error means

This error occurs when your SSH client and the remote server cannot agree on a common encryption algorithm (cipher) to use for the connection. Modern SSH implementations (OpenSSH 7.6+) disabled older, weaker ciphers like 3des-cbc and aes128-cbc by default for security reasons. However, many legacy systems and devices still only support these older ciphers. When your client cannot find any cipher that both sides support, the connection is refused with this fatal error.

Typical symptoms

  • SSH connections fail with "fatal: no matching cipher found" message
  • Unable to connect to legacy servers, routers, switches, or IoT devices
  • Error message shows "Their offer: aes128-cbc,3des-cbc" listing unavailable ciphers
  • Git or other tools that use SSH fail with cipher negotiation errors
  • Connection works from older systems but fails from newer ones

Common causes

  1. SSH server uses only legacy ciphers (3des-cbc, aes128-cbc) that modern clients disable by default
  2. OpenSSH 7.6 or later on client side disabled CBC ciphers for security
  3. Version mismatch between old server and new SSH client software
  4. Server has not been updated to support modern encryption standards
  5. Client has stricter cipher policy than server advertises

How to fix "fatal: no matching cipher found"

1Check what ciphers the server offers

Run this command to see what encryption algorithms your SSH client supports:

bash
ssh -Q cipher

Also check what the server advertises by attempting to connect with verbose output:

bash
ssh -v username@server.example.com 2>&1 | grep cipher

Look for lines showing "Their offer:" followed by a list of ciphers.

2Use the -c flag for a one-time connection

If you need to connect immediately, specify a cipher that both client and server support:

bash
ssh -c aes128-cbc username@server.example.com

If that fails, try other common legacy ciphers:

bash
ssh -c 3des-cbc username@server.example.com

You may also need to specify legacy key exchange algorithms:

bash
ssh -c aes128-cbc -o KexAlgorithms=+diffie-hellman-group1-sha1 username@server.example.com
3Edit your SSH config for persistent settings

For a permanent fix, edit your SSH client configuration file. Add a host-specific block to ~/.ssh/config (user) or /etc/ssh/ssh_config (system-wide):

bash
Host legacy-server
    HostName server.example.com
    User username
    Ciphers +aes128-cbc
    KexAlgorithms +diffie-hellman-group1-sha1
    HostKeyAlgorithms +ssh-dss

The + prefix appends these algorithms to the default list rather than replacing it. Replace legacy-server with a memorable alias, and adjust the hostname, user, and algorithms to match what the server supports.

4Verify the configuration works

Test your SSH config changes without connecting:

bash
ssh -G legacy-server | grep cipher

This shows what ciphers will be used. Then test the actual connection:

bash
ssh legacy-server

If it still fails, verify you used the correct cipher name and that the server actually supports it.

5Consider upgrading the server (best solution)

The ultimate fix is to upgrade SSH on the remote server to a modern version that supports current encryption standards. Weak ciphers are disabled by default because they pose security risks:

- 3des-cbc: Triple DES is slow and can be vulnerable to attacks
- aes128-cbc: CBC mode has known timing vulnerabilities
- diffie-hellman-group1-sha1: Weak key exchange susceptible to Logjam attacks
- ssh-dss (DSA): Deprecated since OpenSSH 7.0, planned for complete removal in 2025

If the server is a vendor device (router, switch, storage), contact support for firmware updates. If it's a server you control, update OpenSSH as soon as possible.

Advanced notes

For server administrators: If you manage the SSH server, ensure it supports modern algorithms. Update /etc/ssh/sshd_config to include at least one modern cipher like chacha20-poly1305@openssh.com or aes256-gcm@openssh.com. Use sshd -T | grep ciphers to verify your configuration. For embedded systems or specialized hardware that only supports legacy ciphers, consider using an SSH bastion host or jump server running a newer SSH version as an intermediary.

Security note: Enabling legacy ciphers creates a security risk. Only enable them for systems you trust and that you plan to upgrade. Do not use legacy algorithms for internet-facing servers or sensitive data.

Frequently asked questions

What does "fatal: no matching cipher found" mean?
This error occurs when your SSH client and the remote server cannot agree on a common encryption algorithm (cipher) to use for the connection. 6+) disabled older, weaker ciphers like 3des-cbc and aes128-cbc by default for security reasons. However, many legacy systems and devices still only support these older ciphers.
How do I fix "fatal: no matching cipher found"?
SSH client and server have incompatible encryption algorithms (ciphers). Modern SSH clients disable weak legacy ciphers by default, causing connections to older servers to fail. Fix by enabling legacy ciphers in your client configuration.
What causes "fatal: no matching cipher found"?
SSH server uses only legacy ciphers (3des-cbc, aes128-cbc) that modern clients disable by default OpenSSH 7.6 or later on client side disabled CBC ciphers for security Version mismatch between old server and new SSH client software
Is the "fatal: no matching cipher found" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading