kex_exchange_identification: read: Connection reset by peer
  yWQPiE9Gg4GL 2023年11月02日 68 0

服务器ssh 密钥连接一直很正常的,今天重启了一下电脑,突然就连不上了:

[zhangpeng@zhangpeng ~]$ ssh ubuntu@xx.xxx.xxx.xxx
kex_exchange_identification: read: Connection reset by peer
Connection reset by xx.xxx.xxx.xxx port 22

image.png 突然就方了怎么回事。网上搜索都是一些无效搜索: image.png 找到了阿里云的文档,顿时明悟: 使用SSH客户端登录Linux实例提示“ssh_exchange_identification: read: Connection reset by peer”错误怎么办? image.png 想到了前几天服务器加了以下脚本并加入计划任务:

#cat /var/log/secure|awk '/Failed/{print $(NF-3)}'|sort|uniq -c|awk '{print $2"="$1;}' > /root/black.txt
DEFINE="5"
for i in `cat  /root/black.txt`
do
   IP=`echo $i |awk -F= '{print $1}'`
   NUM=`echo $i|awk -F= '{print $2}'`
   if [ $NUM -gt $DEFINE ]
     then
      grep $IP /etc/hosts.deny > /dev/null
      if [ $? -gt 0 ]
          then
          echo "sshd:$IP:deny" >> /etc/hosts.deny
      fi
    fi
done

过滤了以下hosts.deny果真IP在里面: image.png 解决方法就是 将IP添加到host.allow文件中去:

sshd:xx.xxx.xxx.22:allow

第一次在阿里云文档这里找到对我有用的东西!感谢!

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  Yoru5qB4TSKM   2023年12月10日   39   0   0 服务器重启IP
yWQPiE9Gg4GL