Secure Shell Debugging ssh problems ssh_exchange_identification: read: Connection reset by peer


This error message may be produced by the OpenSSH ssh client. It means that the TCP connection between the client and the server was abnormally closed by the server immediately after being accepted. Common reasons for this message include:

  • The SSH server process is malfunctioning--for example, it crashed.
  • A firewall, router, or other network device between the client and the server is interfering with the SSH connection.

The phrases in the error message indicate specifically what has happened:

ssh_exchange_identification: 1. After an SSH client makes a connection to an SSH server, the first step in starting the SSH protocol is for the server to send its software version to the client. An error containing "ssh_exchange_identification" indicates that the error occurred immediatly after making the TCP connection, while the client was waiting for the software version from the server.

Connection reset: A connection reset means the TCP connection was "abnormally closed". You can get this if the software process holding one of the TCP connection crashes. Network firewalls can be configured to use connection resets as a means to block TCP connections.

by peer means that the TCP connection was closed from the "other end" of the connection. In this case, the "other end" is the remote SSH server.

Note that this error doesn't indicate any kind of authentication failure. The server closed the TCP connection immediately after accepting it. The client and server have not yet exchanged any data at all. The server has not yet sent a host key to the client, and the client has not yet tried to authenticate with the server.