/errors/ssh-protocol/no-matching-mac-found
Unable to negotiate: no matching MAC found. Their offer: hmac-md5,hmac-sha1-96
- tool
- SSH protocol
- exit code
- 255
- versions
- OpenSSH 7.x+ client, OpenSSH 10.x
- os
- linux, macos, windows
no matching MAC found means the SSH client and server share no message authentication code (MAC) algorithm, the integrity check used with ciphers that do not have one built in. Their offer: lists the server's MACs; hmac-md5, hmac-md5-96 and hmac-sha1-96 are not in the OpenSSH client defaults. Upgrade the server; for a device you cannot upgrade, enable one offered MAC for that host only with MACs +ALGORITHM.
Reproduce it
A test server (Python paramiko on 127.0.0.1) with only the aes128-ctr cipher (so a MAC is needed) and two old MACs:
ssh-keygen -q -t ed25519 -N "" -f hostkey
cat > legacy_mac.py <<'EOF'
import socket, paramiko
key = paramiko.Ed25519Key(filename="hostkey")
srv = socket.socket(); srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
srv.bind(("127.0.0.1", 4927)); srv.listen(1); srv.settimeout(30)
conn, _ = srv.accept()
t = paramiko.Transport(conn)
t._preferred_ciphers = ("aes128-ctr",)
t._preferred_macs = ("hmac-md5", "hmac-sha1-96")
t.add_server_key(key)
try:
t.start_server(server=paramiko.ServerInterface())
except Exception:
pass
t.close()
EOF
uv run -q --no-project --python 3.13 --with paramiko==4.0.0 python legacy_mac.py 2>/dev/null &
sleep 5
ssh -p 4927 -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null 127.0.0.1 true
echo "ssh exit code: $?"
waitOutput
Unable to negotiate with 127.0.0.1 port 4927: no matching MAC found. Their offer: hmac-md5,hmac-sha1-96 ssh exit code: 255
Enable the MAC for one host
Host old-nas
HostName 192.0.2.20
MACs +hmac-sha1-96Confirm the client offers it, without connecting:
ssh -T -G -o MACs=+hmac-sha1-96 old-nas | grep -i '^macs' | tr ',' '\n' | grep -x 'hmac-sha1-96'Output
hmac-sha1-96
ssh -Q mac lists every MAC the client binary supports. The client defaults already include hmac-sha1, hmac-sha2-256 and hmac-sha2-512 (plus -etm@openssh.com and umac variants), so a legacy server that triggers this error usually offers only MD5 or truncated -96 MACs. Of those, pick hmac-sha1-96 over the MD5 ones.