解决ssh_exchange_identification: read: Connection reset by peer
The above error occurs when linux remote password-free login
1. First on the remote machine
vi /etc/hosts.allow
write inside
#允许所有ip连接到这台机器
sshd:ALL
First allow all IPs to connect to this machine
and then press esc
Enter :wq
to save.
2. Restart the sshd service on the remote machine
systemctl restart sshd
3. Try to connect remotely on this machine
ssh -l ${登陆的用户名} -p ${登陆的端口} ${登陆的ip}
Can also be used
ssh -l ${登陆的用户名} -p ${登陆的端口} ${登陆的ip} -v
View login details
Previously, all IPs were set to be able to connect to the remote server. If you are not sure, you can continue to control the remote connection IPs according to the following method.
4. If the machine can connect to the remote server at this time, enter in the connected terminal
who
View the currently logged in IP
5. Modify /etc/hosts.allow of the remote machine
vim /etc/hosts.allow
Replace the previously added sshd:ALL
IP with the IP viewed in step 4, sshd:${你查到的ip}
save and exit, and restart the sshd service.
systemctl restart sshd