1、设置服务器向SSH客户端连接会话发送频率和时间
#vi /etc/ssh/sshd_config,添加如下两行
ClientAliveInterval 60
ClientAliveCountMax 86400

注:ClientAliveInterval选项定义了每隔多少秒给SSH客户端发送一次信号;ClientAliveCountMax选项定义了超过多少秒后断开与ssh客户端连接

重新启动系统SSH服务
#service sshd restart

 

2、设置profile

使用命令“vi /etc/profile”修改配置文件,设置“TMOUT=180”,即超时时间为3分钟

[转自http://bbs.51cto.com/thread-837537-1.html]