问题描述

Linux 通过远程工具 经常出现连接断开的问题;

Linux系统版本 Centos7

连接客户端 finalShell 3.9.4

解决

  1. 编辑ssh配置文件

    1
    sudo  vim /etc/ssh/sshd_config
  2. 添加 或放开配置

    1
    2
    3
    TCPKeepAlive yes
    ClientAliveInterval 5
    ClientAliveCountMax 180
    • TCPKeepAlive 保持连接
    • ClientAliveInterval 客户端的心跳间隔
    • ClientAliveCountMax 客户端最大的超时时间
  3. 重启服务

    1
    systemctl restart sshd

​ 但是通过这种方式并没有效果;

  1. 配置环境变量中的 TMOUT

    1
    vim /etc/profile
  2. 写入内容

1
export TMOUT=0

0 表示了不超时。

参考连接: https://blog.csdn.net/GGxiaobai/article/details/53507161

https://zhuanlan.zhihu.com/p/106671611