SSHexit code > 0
kex_exchange_identification: Connection reset
$kex_exchange_identification: read: Connection reset by peer
Analysis
The SSH connection was established, but the server closed it immediately during the initial handshake (Key Exchange).
Common Triggers
- ●Server is overloaded (fail2ban or similar blocking IP).
- ●Network middlebox (firewall/proxy) intercepting and dropping connection.
- ●TCP Wrappers (
/etc/hosts.deny) blocking access.
Debug Checks
- $Run
ssh -vto see at what stage it fails. - $Check server logs (
/var/log/auth.log) if accessible.
Resolution
1
Wait a few minutes (if blocked by fail2ban).
2
Whitelist your IP in
/etc/hosts.allow on the server.Metadata
- Tool
- SSH
- Severity
- High
- Tags
- #ssh#network#handshake