通过ssh连接服务器报错:ssh_exchange_identification: read: Connection reset by peer

Jacky Linux 2022-07-05 25

问题:ssh_exchange_identification: read: Connection reset by peer

原因1:连接并发限制,有连接一直没有关闭

# 查看22端口连接数
netstat -tnp | awk '$4~/.*:22$/' | wc -l

原因2:IP限制,服务端禁止登录

cat /etc/hosts.allow
cat /etc/hosts.deny
# 查看是否包含 `all:all:deny`,删除或注释掉
# 重启
systemctl restart sshd

原因3: 权限问题

#重启服务
systemctl restart sshd
# 提示权限问题,赋权在重启
chown -R root:root /var/empty/sshd/