用 Xshell 连接服务器总是报错 :

  • Connection closed by foreign host.
  • Disconnected from remote host...

原因可能是 SSH 服务器没设置保活时间间隔 , 具体设置如下 :

操作

  • # vim /etc/ssh/sshd_config

添加两行 , 或去掉注释 :

  • ClientAliveInterval 60
  • ClientAliveCountMax 3

重启 SSH 服务 :

  • /etc/init.d/ssh restart
  • systemctl restart sshd //这个命令我没执行成功,最后还是远程连接上了

补充

ClientAliveInterval 参数数值是秒 , 是指超时时间 , 上面设置的是一分钟 ;
ClientAliveCountMax 设置允许超时的次数 , 上面设置的是允许三次 , 之后就关闭连接 ;

解决 SSH Connection closed by foreign host 问题相关推荐

  1. xshell 常用配置_Xshell连接报Connection closed by foreign host错误的解决办法

    最近阿里云服务器控制管理平台升级后变化很大,在服务器安全上也更加完善,部分功能也加入付费需求,系统打补丁也开始收钱啦.导致很多人在用Xshell连接服务器的时候莫名报很多错误. 下面说说最常报的连接错 ...

  2. docker 运行镜像后,telnet 出现Connection closed by foreign host或连接被重置(已解决)

    看了一天了,查看了各种帖子,都没解决.自己终于看出问题来了 telnet 会报Connection closed by foreign host 网页会报,连接被重置 搞定

  3. Connection closing...Socket close. Connection closed by foreign host. Disconnected from remote hos

    SSH连接服务器出错 Connection closing...Socket close. Connection closed by foreign host. Disconnected from r ...

  4. Unencrypted connection refused. Goodbye. Connection closed by foreign host.

    telnet 登录提示:Unencrypted connection refused. Goodbye. Connection closed by foreign host. 原因:ekrb5-tel ...

  5. xshell连接突然报Connection closed by foreign host.

    1问题描述报错 Connection closed by foreign host. Disconnected from remote host(yaoGS) at 155513. 2登入虚拟机 在l ...

  6. telnet Connection closed by foreign host.

    以前了解过telnet信息,类似于ssh的服务,但是不安全.后来就使用telnet的网络分析功能来分析网络的联通性了. 今天同事问到我,Connection closed by foreign hos ...

  7. Connection closed by foreign host. 误改BUG

    昨天调试远程服务器,为了增加socket链接数,理所当然的进行了limits.conf配置,之后悲剧发生了. 利用xshell再度远程时,被强制T了.链接瞬间即断,如果幸运,会弹出 "Con ...

  8. linux 报错:telnet Connection closed by foreign host

    0.美图 1.背景 链接kudu 报错. # telnet samba.xx.com 7051 Trying 172.xx1.xx.33... Connected to samba.example.c ...

  9. shell中Connection closed by foreign host问题解决

    shell中Connection closed by foreign host问题解决 ip冲突导致连接中断 换成wifi连接

最新文章

  1. python语言的解释性特点指的是编写的程序不需要编译_解释性与编译型 Python2和python3的区别...
  2. PHP删除文件unlink
  3. session实现验证码功能
  4. 【MongoDB学习笔记21】MongoDB的复合索引
  5. 固定资产打开提示:上年度数据未结转!
  6. java用户角色权限管理 只显示姓_快递物流管理系统SSM,JQUERYEASYUI,MYSQL
  7. Python 入门到精通(—)初识Python
  8. Linux在线安装Mysql数据库(Linux)
  9. nand flash和nor flash区别_从闪存的发展历史看,eMMC与NAND Flash有什么区别与联系?...
  10. ORB-SLAM3 代码解读
  11. BBS论坛系统需求说明书
  12. 最容易扩展的光立方程序设计
  13. 电商ERP软件、订单管理系统、库存管理系统
  14. android一键改机之真改机build.prop
  15. xctf攻防世界 MISC高手进阶区 flag_universe
  16. Pidgin 2.3.1语言设置方法
  17. 中国数据量占全球27.8%!安防能否借机“回血”?
  18. Oracle 递归查询SQL
  19. Buffon投针问题
  20. [Win32]重绘的基本概念以及简单的文本输出文本输出

热门文章

  1. winform 判断控件有没有被遮挡_编程入门基础之 winform(2)
  2. 什么是事务、事务特性、事务隔离级别、spring事务传播特性
  3. AZURE 日志分析自动告警
  4. golang 包含 数组_Golang数组类型
  5. python断点调试_「Python调试器」,快速定位各种疑难杂症!!!
  6. 数据结构 - 栈(链表实现栈的入栈出栈)
  7. 【Python CheckiO 题解】I Love Python!
  8. PWN-PRACTICE-BUUCTF-23
  9. 华为双系统是鸿蒙系统吗,华为p50pro是鸿蒙系统吗-华为p50pro有双系统吗
  10. 【POJ - 1486】Sorting Slides(思维建图,二分图求必须边,关建边,图论)