When you use the SSH client, you may receive the “SSH_exchange_identification: connection closed by remote host” error message. If you want to find some methods to fix the issue, you can read this post from MiniTool. Here are some feasible fixes.
When you use the SSH client to connect the server, you may encounter the “SSH_exchange_identification: connection closed by remote host” issue. This issue can be caused by several reasons, such as the problems related to hosts.deny and hosts.allow configuration files.
Now, let’s see how to fix the “SSH _exchange_identification” issue.
Related Article: How to Set up SSH Client and Server on Windows 10 [Full Guide]
How to Fix SSH_Exchange_Identification: Connection Closed by Remote Host
Fix 1: Check for Missing Dependencies
If you only receive the “connection closed by remote host” error message after updating OpenSSL or Glibc, it’s recommended to check for missing dependencies. Although many distributions can install updates to Glibc or OpenSSL without restarting, your distribution may not be in the same category.
If you know that the update of Glibc has been installed, please use lsof to view the open file location of SSHD. If you are using Ubuntu or Debian, you should use the upgrade command to obtain the new package and install it.
Fix 2: Check for Extra SSH Sessions
If the “SSH_exchange_identification: connection closed by remote host” error message still appears, you can also check for extra SSH sessions. Maybe, you don’t know the maximum number of SSH sessions and you exceed it.
Then, you can try to clear the old session and reconnect to the server. You can run the who command to view the logged-in user process. You should only see one or two users logged in. If there are multiple concurrent users, you should kill the user process, and try to log in again.
Now, check if the “SSH_exchange_identification: connection closed by remote host” issue has been fixed. If not, try the next methods.
Fix 3: Check for Corrupted Fingerprint/Keys
Then, you can check if the fingerprint or keys has been corrupted. If you have installed these files manually, this issue is most likely to happen. You need to try to delete the server-side fingerprint in the ~/.ssh/known_hosts client and try again. When reconnecting, you will be prompted to accept the host identity. Just accept and continue.
After that, you can check if the “SSH_exchange_identification: connection closed by remote host” issue still exists.
Fix 4: Check for Server Load
If the issue still exists, you had better check for server load since this error can also occur if your server is under heavy load. You should check whether the server has sufficient resources to perform the task, or whether it is subjected to brute force attacks.
You can try to increase the number of connections that SSHD can run to solve the problem. Now, the “SSH_exchange_identification: connection closed by remote host” issue should be fixed.
Final Words
To sum up, this post has shown 4 ways to fix the “SSH_exchange_identification: connection closed by remote host” issue. If you come across the same error, try these solutions. If you have any better solution to fix it, you can share it in the comment zone.
User Comments :