You should know that this error is not a very familiar error message. Generally, this error arises when you try to Ssh into any kind of Unix server. This error can arise both in the Mac or the Windows devices. Ssh is universal across Unix and Linux operating systems.
Sometimes, the server is the reason for this error. Thus, the remote server might reset the connection without your permission. You might not know how to fix the ssh_exchange_identification: read: connection reset by peer errors.
Thus, you can go through the steps that are mentioned below.
Effective Ways to Fix “ssh_exchange_identification: read: Connection Reset by Peer”
Below discussed are the effective solutions that you can implement on your own to fix this problem permanently.
Solution 1: Check the hosts. deny File
Before applying this step, make sure that you have the administrative privileges on the server. First, navigate to the server’s hosts.deny file and then check it’s contents.
Sometimes, the operating system might not have permission to operate the server. At that time, you will find that there is a line with your IP address.
Navigate to the server to type the following command: sudo nano /etc/hosts.deny. Thus, you will be able to view the content. With the help of your IP address, you need to remove the entry.
Now, you should try to reconnect the server. Then, check if there is anything that connects to this machine with your username. If there is any single line, then your access can be blocked. To fix this problem, you can add your credentials and IP address to this file.
Now, you need to enter the following command in order to open the hosts.allow file.Sudo /etc/hosts.allow.
Thereafter, you need to type your logging information and the IP address to the file in order to make a successful connection. Check you entered the actual host or not.
Now, you need to save the file and for that hit CTRL and O at the same time on the keyboard. Finally, press Ctrl and X, simultaneously to exit from this file.
Solution 2: Change ssh Configuration
To fix this problem, you need to remove your old ssh configurations files. After an update check whether the error exists or not. If you do not find the error, then add the V option to ssh. Then, try to connect again.
Sometimes, you might still get an error message. At that time, you need to add -c aes256-ctr to ssh. Thus, you can connect to the server which you were attempting to ssh.
If you are troubleshooting using any Cisco-branded equipment, then add -c aes256-ctr to your usual ssh command.
Solution 3: Overriding Accidental IP Bans
Sometimes, you can face this error because of the server. If you try to fix this problem, then look into the tables. You can find that the server has banned your IP address mistakenly.
Many times, the fail2ban subroutine notice this action as an attack. Then, your IP address will be blocked automatically.
Go to the Command line to run the below-mentioned command. Then, you should search your IP address: Sudo iptables -L -line-number
Now, you will notice that there are various unrelated networks and you can ignore them. You can delete one rule from the chain with the help of the -D flag.
If you find that still, the problem persists, then you need to edit the following line.
Now, search the line that has “ignoreip”. This will help you to prevent fail2ban from blocking your IP address.
Hopefully, after applying these steps manually, you will be able to fix the ssh_exchange_identification: read: connection reset by peer without any hassle.