Ssh_exchange_identification: Connection Closed by Remote Host [Fix]

Check the server load or any issues with it

Reading time icon 3 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more

Key notes

  • The ssh_exchange_identification: connection closed by remote host Windows error points to server issues or missing dependencies.
  • Your primary approach should be to verify the server load and reduce it.
  • For some users, removing multiple instances of SSH did the trick!
fix ssh_exchange_identification connection closed by remote host windows

While using an SSH client to connect to your server, you may encounter some ugly errors. One such error is the ssh_exchange_identification: connection closed by remote host in Windows. The error appears on other operating systems as well.

This error can occur due to many reasons, including the SSH keys used for a connection being corrupt or issues with the server. Keep reading to find out how you can fix things when a ssh connection is closed by a remote host immediately!

How do I fix connection closed by remote host?

Before we move to the slightly complex solutions, verify these first:

  • This error can also occur if your server is under heavy load. Check if the server has enough resources to do the task or if it is under brute force attack.
  • Increasing the amount of connection SSHD can run to resolve the issue.

If none work, head to the fixes listed next.

1. Check for missing dependencies

This ssh_exchange_identification: connection closed by remote host Windows error usually occurs after a Glibc or OpenSSL update and the server fails to restart.

While many distros can install the update to Glibc or OpenSSL and not require a restart, yours may not fall in the same category.

If you know the update for the Glibc is installed, use lsof to see where the SSHD has open files. For those using Ubuntu or Debian, use the upgrade command to get new packages and install them. This will help fix any issues that may have occurred due to broken packages.

2.  Check for extra SSH sessions

ssh_exchange_identification: connection closed
  1. Try to clear up the old sessions and then reconnect to the server.
  2. At any given time, you should see only one or two users logged in. To check if there are multiple instances of SSH running, use the following command:who
  3. If there are more than two users logged in, then kill the user processes one by one.
  4. Reconnect to the server using SSH and check for any improvements.

It is possible that the users may have exceeded the maximum number of SSH sessions without knowing it.

This ssh_exchange_identification: connection closed by remote host error in Windows or Linux occurs if the SSH can’t keep up with a script that starts multiple SSH sessions back to back. You can also delay the SSH session with the sleep command.

3.  Check for corrupted fingerprints/keys

  1. Remove the server-side fingerprint in the clients ~/.ssh/known_hosts and try again.
  2. When you re-connect, you will be prompted to accept the host identity. Accept and proceed.
  3. This error can also show up if the files  /etc/ssh/*key*  are removed, and SSHD is not restarted. Check the SSH configuration directory for the key files.

If the issue persists, check for corrupted fingerprints or keys. This is most likely to happen if you have installed these files manually.

Once done, find out whether the connection is still lost after the ssh_exchange_identification connection closed by remote host lost connection error. In all likelihood, things should be up and running.

Before you leave, find out some quick and easy tips to improve the performance of your Windows PC.

If you have any other questions or suggestions, feel free to leave them in the comments section below.

More about the topics: Fix network issues, windows servers

User forum

0 messages