黑白格子

  • 首页
  • 所有文章
  • 文章分类
  • 关于页面
  • 友链

  • 搜索
随笔 脚本 Shell MAC IE SSL iptables 网络 k8s docker ubuntu web 镜像 Nginx Linux Windows cloud-init

linux ssh连接报错Connection closed by remote host

发表于 2020-06-06 | 分类于 Linux | 0 | 阅读次数 147

远程连接CentOS服务器时发现有这样的报错: Connection closed by remote host
ssh 加上 -v 参数打印下debug信息:

root@CentOS6.5  ~ # ssh -v 172.17.0.10
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 172.17.0.10 [172.17.0.10] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/identity-cert type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
ssh_exchange_identification: Connection closed by remote host

看ssh debug提示很明确,服务器主动断开连接无法远程连接,这里就需要通过VNC登陆服务器检查服务器端了,可以从以下几个方面排查解决:

  • CVM安全组、防火墙 iptables、firewalld 等是否有对源地址的限制
  • 检查 /etc/hosts.deny 和 /etc/hosts.allow 文件是否配置拒绝了本地IP连接到服务器
  • ssh会话数量太多,修改sshd_config中的MaxSessions参数,增加会话数量(服务器连接一直没有问题,突然出现此报错)
  • 以上排查都没有问题重启sshd服务看下,或者检查服务器CPU、外网带宽等资源是否负载过高
  • 本文作者: 黑白格子
  • 本文链接: https://www.clhuang.cn/?p=39
  • 版权声明: 本博客所有文章除特别声明外,均采用CC BY-NC-SA 4.0 许可协议。转载请注明出处!
# 随笔 # 脚本 # Shell # MAC # IE # SSL # iptables # 网络 # k8s # docker # ubuntu # web # 镜像 # Nginx # Linux # Windows # cloud-init
利用Nali-ipip在线工具查看域名解析/IP位置/MTR追踪路由
Linux下批量ping小工具
黑白格子

黑白格子

54 日志
11 分类
17 标签
Creative Commons
0%
© 2021 黑白格子
主题 - NexT.Mist
网站已稳定运行:
陕ICP备16020191号