Secure Shell ssh_exchange_identification: Connection closed by remote host


This error message may be produced by the OpenSSH ssh client. It means that the TCP connection between the client and the server was closed by the server immediately after being accepted. This message generally indicates the SSH server has been configured not to accept connections from the client for some reason:

  • The server may be configured to refuse connections from the client's IP address.
  • The server may be configured with a limit on the number of active SSH connections.
  • The client may have connected to something that's not an SSH server.

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 immediately after making the TCP connection, while the client was waiting for the software version from the server.

Connection closed: This means the TCP connection was closed in a normal fashion. It indicates that the SSH server deliberately closed the connection. This is in contrast to "Connection reset", which could indicate that the SSH server crashed or malfunctioned.

by remote host 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.