免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1408 | 回复: 0
打印 上一主题 下一主题

[转载]SSH超时断开连接的解决办法 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-06-22 16:04 |只看该作者 |倒序浏览
[转载]SSH超时断开连接的解决办法
2007-10-15  22:26
高版本的Linux自带的OpenSSH在使用的时候,几分钟不操作的话就会自动断开连接,这是出于安全的考虑,但是对于需要长时间使用的用户来说很麻烦,每次都要重新连接。解决方法如下:
将/etc/ssh/sshd_config中的“ClientAliveInterval”设置取消注释,并把0改为一个较小的数值即可。具体说明参看下面的解释:
OpenSSH ClientAliveInterval
Using an OpenSSH server's ClientAliveInterval,
it is possible for the ssh server to send periodic "keep alive"
messages to the ssh client, keeping the connection open indefinitely.
This is useful when a firewall or other packet filtering device drops
idle connections after a certain period of time. Note that this is
different from the KeepAlive directive in ssh_config.
From the sshd_config manpage:
      ClientAliveInterval
              Sets a timeout interval in seconds after which if no data has
              been received from the client, sshd 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 version 2 only.
Example (send "keep alive" messages every 5 minutes) on Red Hat Linux:
1. Add ClientAliveInterval 300 to /etc/ssh/sshd_config
2. Reload the sshd server configuration with /sbin/service sshd reload
Note: you may want to configure the ClientAliveCountMax value in sshd_config to set the number of times that "keep alive" messages are sent. If ClientAliveCountMax
number of "keep alive" messages are not acknowledged by the ssh client,
the connection is terminated by the ssh server. The default value of 3
should be sufficient for most users.
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/86325/showart_1973181.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP