SSH自动断开连接的解决方法

  1. 编辑sshd配置文件

    vim /etc/ssh/sshd_config
    
  2. 找到以下两项配置

    #ClientAliveInterval 0
    #ClientAliveCountMax 3
    

    修改为

    #客户端每隔多少秒向服务发送一个心跳数据
    ClientAliveInterval 30
    #客户端多少秒没有相应,服务器自动断掉连接
    ClientAliveCountMax 86400 
    
  3. 重启sshd服务(centos7+)

    systemctl restart sshd
    
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章