centos7.6
xshell7
ssh长联状态,不主动断开
末尾添加export TMOUT=0
- vim /etc/profile
-
-
-
- export TMOUT=0
默认都被注释掉,放开并设置CAI参数为0-60间
- vim /etc/ssh/sshd_config
-
-
-
- ClientAliveInterval 30
- ClientAliveCountMax 3
请检查是否出现IP地址冲突情况
PS2:一句话操作实施中12
sudo sed -i 's/^export TMOUT=.*/export TMOUT=0/' /etc/profile &&sudo sed -i "/#ClientAliveInterval/a\ClientAliveInterval 60" /etc/ssh/sshd_config &&sudo sed -i "/#ClientAliveInterval/d" /etc/ssh/sshd_config &&sudo sed -i '/ClientAliveCountMax/ s/^#//' /etc/ssh/sshd_config &&sudo /bin/systemctl restart sshd.service