Putty 连接centOS7 超时问题

方法1:

#vim /etc/ssh/sshd_config(添加或修改以下配置)
ClientAliveInterval 60(每隔60秒给SSH客户端发送一次信号)  
ClientAliveCountMax 1440(超时达到多少次数后断开SSH客户端连接)
上面配置表中的#注释需要去掉
#systemctl restart sshd.service(重启SSH服务)
SSH重启成功显示:Redirecting to /bin/systemctl restart sshd.service

方法2:

#echo export TMOUT=1000000 >> /root/.bash_profile (设置环境变量为1000000,用户没有操作时,超过该秒断开SSH会话)
#cat /root/.bash_profile  (打印查看是否写入)
#source .bash_profile
#cp /etc/ssh/sshd_config /etc/ssh/sshd_config_bak
#echo ClientAliveInterval=60 >> /etc/ssh/sshd_config
#service sshd restart (重启SSH服务)
#cat /etc/ssh/sshd_config
#exit

方法3:

export timeout = -1

 每次上线需要设置一次,这个方法不写配置表。

相关:

无法重启ssd 服务时,使用以下指令查询错误。

/usr/sbin/sshd -T

比如查询到2个错误:

原文地址:https://www.cnblogs.com/siyun/p/11903705.html