转载自:yaozer博客来的ssh是不会超时的, 但是自从上次给ubuntu Server 系统升级后, 出现了ssh 超时现象:只要putty连续3分钟左右没有输入, 就自动断开, 然后必须重新登陆, 很麻烦.
在网上查了很多资料, 发现原因有多种, 环境变量TMOUT引起,ClientAliveCountMax和ClientAliveInterval设置问题或者甚至是防火墙的设置问题. 所以可以这么尝试:
1, echo $TMOUT
如果显示空白,表示没有设置, 等于使用默认值0, 一般情况下应该是不超时. 如果大于0, 可以在如/etc/profile之类文件中设置它为0.
Definition: TMOUT: If set to a value greater than zero, the value is interpreted as the number of seconds to wait for input after issuing the primary prompt. Bash terminates after waiting for that number of seconds if input does not arrive.
2. ClientAliveInterval 60
在/etc/ssh/sshd_config中增加ClientAliveInterval 60, ClientAliveInterval指定了服务器端向客户端请求消息的时间间隔, 默认是0, 不发送.而ClientAliveInterval 60表示每分钟发送一次, 然后客户端响应, 这样就保持长连接了.这里比较怪的地方是:不是客户端主动发起保持连接的请求(如FTerm, CTerm等),而是需要服务器先主动.
另外,至于ClientAliveCountMax, 使用默认值3即可.ClientAliveCountMax表示服务器发出请求后客户端没有响应的次数达到一定值, 就自动断开. 正常情况下, 客户端不会不响应.
ClientAliveCountMax
Sets the number of client alive messages (see below) which may be
sent without sshd(8) receiving any messages back from the client.
If this threshold is reached while client alive messages are
being sent, sshd will disconnect the client, terminating the ses-
sion. It is important to note that the use of client alive mes-
sages is very different from TCPKeepAlive (below). The client
alive messages are sent through the encrypted channel and there-
fore will not be spoofable. The TCP keepalive option enabled by
TCPKeepAlive is spoofable. The client alive mechanism is valu-
able when the client or server depend on knowing when a connec-
tion has become inactive.
The default value is 3. If ClientAliveInterval (see below) is
set to 15, and ClientAliveCountMax is left at the default, unre-
sponsive SSH clients will be disconnected after approximately 45
seconds. This option applies to protocol version 2 only.
ClientAliveInterval
Sets a timeout interval in seconds after which if no data has
been received from the client, sshd(8) will send a message
through the encrypted channel to request a response from the
client. The default is 0, indicating that these messages will
not be sent to the client. This option applies to protocol ver-
sion 2 only.
3. 启用putty keepalive
putty -> Connection -> Seconds between keepalives ( 0 to turn off ), 默认为0, 改为60.
4. 上述3个方法应该能解决大部分问题, 如果不行, 请 man sshd_config, 然后尝试更改其他设置吧.
相关推荐
linux ssh putty.zip
SSH隧道管理内部服务(putty,ssh secure shell)forWINDOWS windows下使用putty和ssh secure shell的隧道功能映射远程主机的方法 网上有些关于putty和ssh secure shell 如何建立隧道的文章.我觉得写的不清楚.有必 ...
putty ssh工具,远程管理linux的必备工具
putty适用于ssh ssh2协议服务
putty是Telnet、SSH、rlogin、纯TCP以及串行接口连接软件
Windows平台ssh客户端putty.zip,PuTTY是一个Telnet、SSH、rlogin、纯TCP以及串行接口连接软件。
windows专用ssh——putty,可远程连接服务器,可执行文件,下载就可以使用
怎样用putty设置SSH tunnel 凡是不晓得SSH为何物的朋友可以略过,也可以google SSH开始了解它。这儿不重复了。
利用SSH工具中常见的开源软件Putty来实现安全的代理,通过与国外的一款开通SSH功能的空间来建立Tunnels,实现安全连接。
ssh tool, putty. support ssh, com, etc.
linux 的连接工具 ssh 和putty
ssh 客户端,Putty是ssh 客户端软件,是一个很好同时又很小的一个软件,不用安装,直接使用
Putty是一个免费的、Windows 32平台下的telnet、rlogin和ssh客户端,但是功能丝毫不逊色于商业的 telnet类工具。用它来远程管理Linux十分好用,其主要优点如下: ◆ 完全免费; ◆ 在Windows 9x/NT/2000下运行的都...
putty中文乱码方案方法 putty中文乱码方案方法 putty中文乱码方案方法
远程ssh工具 putty
PuTTY是一个Telnet、SSH、rlogin、纯TCP以及串行接口连接软件。除了官方版本外,有许多第三方的团体或个人将PuTTY移植到其他平台上,像是以Symbian为基础的移动电话。较早的版本仅支持Windows平台,在后来的版本开始...
很好用的linux远程管理工具 linux -ssh连接工具-PuTTY中文版
ssh远程工具很多,如果不需要多余的功能,putty是个很好的选择,体积小,干净,免费,响应快,不要太好用
putty ssh远程登录工具 串口调试
ssh服务端及其客户端putty,附带中文教程和putty的其他组件(包括pageant\plink\pscp\psftp\puttygen\puttytel等)