1. sudo vim /etc/ssh/sshd_config
  2. ClientAliveInterval 30
    ClientAliveCountMax 99

    ClientAliveInterval: 服务器向客户端发送保持活动请求的时间间隔(秒)。
    ClientAliveCountMax: 服务器在断开连接前允许的最大未响应请求数。

参考

  1. https://blog.csdn.net/qq_36803941/article/details/139982867