因为安全方面的考虑, ssh服务默认在一段时间内不操作会断开连接, 解决方法修改ssh的配置文件, 让ssh每隔一段时间就自动进行一次连接, 以达到保持连接的目的.

首先找到ssh配置文件的位置: 

find / -name ssh_config

找到以后, 用vim打开ssh_config文件, 添加以下两行

ServerAliveInterval 50 #每隔50秒就向服务器发送一个请求
ServerAliveCountMax 3  #允许超时的次数,一般都会响应

 

完成后保存退出, 再重启ssh服务即可.

相关文章:

  • 2021-07-12
  • 2022-12-23
  • 2021-12-15
  • 2022-01-02
  • 2022-03-01
  • 2021-12-15
猜你喜欢
  • 2022-12-23
  • 2022-02-11
  • 2022-01-27
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案