爲了安全性;
ssh默認的連接超時時間很短;
經常就是發個呆就斷開了;
事實上是可以修改超時時間的。
示例環境:
服務器:centos7
[root@iZwz9exe2jul8fc4gtaydyZ log]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
1.先備份下配置項;
養成備份配置項的好習慣;
cp /etc/ssh/sshd_config sshd_config.bak
2.編輯sshd_config文件
刪除ClientAliveInterval 0 前面的註釋#號 並改爲ClientAliveInterval 600
刪除lientAliveCountMax 3 前面的註釋#號 並改爲ClientAliveCountMax 10
3.重啓下ssh服務
service sshd reload;
/etc/init.d/sshd restart;
轉自大海技術博客 https://www.ypyunedu.com/article/90