Fortunately, the SSH Exchange Identification: Read: Connection Reset By Peer issue is uncommon. One of the biggest causes of this problem is the process of transforming ssh into any Unix server.
It’s a popular fallacy that using Windows with Cygwin to access other operating systems, such as Ubuntu, or Mac OS with Terminal to ssh into Linux Arch, Fedora, or CentOS, can help you get rid of SSH Exchange Identification: Read about the error Connection Reset By Peer.
SSH Exchange Identification: How to Fix: Read: Peer Error Resets Connection
Alas! Resetting the connection without permission can always result in this error, even if ssh is universal across Unix and Linux.
Solution 1: Hosts.deny File
If you have administrative access to your system servers, the simplest option is to go to a prompt with credentials that allow you to connect to the server’s computer and look at the “hosts.deny” file.
On the server, run the command “Sudo nano /etc/hosts.deny“. After that, look to see whether your system has been added to any blacklists. If that’s the case, you can fix it by disconnecting and reconnecting using ssh on another system.
Check to see if any additional wildcards are preventing your machine from connecting to the internet. A new file with nothing except the default text inserted by the server’s distribution, on the other hand, would be fine.
You can always try a manual login by running “sudo /etc/hosts.allow” to make a good connection. It should be emphasized that adding them is rarely essential, but if you do, you must follow the informational language provided by the distribution.
When a line like ALL: any site.com is added to the bottom, it allows everyone on any site.com to connect to the server. Make sure you don’t make any typing errors, then press Ctrl + O to save the file and Ctrl + X to quit.
Solution 2: Changing SSH Configuration Options
If you were unable to access the remote server using the prior method, try sweeping out the ssh configuration files and seeing if the error persists. If there isn’t an error message, add the -v option to ssh and try to connect again.
If you’ve removed ssh exchange identification, try adding -c aes256-ctr to your ssh command: read: peer error causes the connection to be reset Because the cipher list is condensed, you may connect to the server you were trying to ssh into because the packet size is reduced.
Because some pieces of server gear have a protocol to assume reduced packet sizes, debugging some Cisco branded equipment has proven to be highly useful. Simply add -c aes256-ctr to your regular ssh command, and you should be good to go.
Solution 3: OverComing Inadvertent IP Blocks
It’s conceivable that your access was refused each time. It was possible that your own server mistook you for a bad IP address. When you repeatedly retry the connection while troubleshooting, this is frequently the case. It could be interpreted as an attack on the fail2ban code, even if it’s only a regular response.
Make sure this isn’t the source of the problem.
Step 1: From the remote connect, run sudo iptables -L –line-number to find your IP address. Many irrelevant relationships can be overlooked.
Step 2: Once you’ve identified the problem, type iptables -D, then the offending chain and chain number. It assists you in avoiding being banned from your software once more.
Step 3: You should have gotten rid of any errors linked to this by now. If you do, however, you can change the following: /etc/fail2ban/jail.conf. Run it as root in your text editor, most likely nano or vi.
Step 4: Then type sudo nano/etc/fail2ban/jail.conf into your terminal. Then check for the word “ignoreip” on a line. To this line, add your IP address. It prevents fail2ban from adding your IP address to any of the blocklists indefinitely.
Step 5: Different Linux distributions handle these situations differently. You should, however, make these modifications as quickly as feasible.
SSH Exchange Identification: The Connection Reset By Peer error is uncommon, but it can cause a lot of problems for your computer. It makes no difference whether you use Linux or another operating system.
To fix this error, make sure you have a backup of your system and use the techniques listed above.
Thank you for taking the time to read this!