在ssh的配置文件中有2个参数可以控制空闲连接超时断开。这2个参数是ClientAliveCountMax和ClientAliveInterval。

Solaris10上设置空闲ssh连接超时断开的方法如下:

  1. 修改/etc/ssh/sshd_config文件,在文件中加入以下内容:
  2. ClientAliveCountMax = 0
  3. ClientAliveInterval = 600 #单位是秒
  4.  
  5. 然后重启ssh服务:
  6. #> svcadm restart ssh

这两个参数的说明参见man sshd_config

  1. ClientAliveCountMax
  2.  
  3. Sets the number of client alive messages (see Clien-
  4. tAliveInterval, below) that can be sent without sshd
  5. receiving any messages back from the client. If this
  6. threshold is reached while client alive messages are
  7. being sent, sshd will disconnect the client, terminating
  8. the session. It is important to note that the use of
  9. client alive messages is very different from KeepAlive
  10. (see below). The client alive messages are sent through
  11. the encrypted channel and therefore will not be spoofa-
  12. ble. The TCP keepalive option enabled by KeepAlive is
  13. spoofable. The client alive mechanism is valuable when a
  14. client or server depend on knowing when a connection has
  15. become inactive.
  16.  
  17. The default value is 3. If ClientAliveInterval (below)
  18. is set to 15, and ClientAliveCountMax is left at the
  19. default, unresponsive ssh clients will be disconnected
  20. after approximately 45 seconds.
  21.  
  22. ClientAliveInterval
  23.  
  24. Sets a timeout interval in seconds after which, if no
  25. data has been received from the client, sshd sends a
  26. message through the encrypted channel to request a
  27. response from the client. The default is 0, indicating
  28. that these messages will not be sent to the client. This
  29. option applies only to protocol version 2.

需要说明的是man里的说明似乎有错误。按照man里面的说明,如果设置ClientAliveCountMax=3,ClientAliveInterval=15,空闲连接应该在45秒左右自动断开,但实际测试时发现必须设置ClientAliveCountMax=0,空闲连接才能自动断开。

Solaris10 如何设置空闲ssh连接超时断开的更多相关文章

  1. Putty等工具中解决SSH连接超时断开的问题

    转自:http://www.putty.ws/putty-chaoshi 1 在 linux下的ssh命令:vim /etc/ssh/ssh_config 然后找到里面的ServerAliveInte ...

  2. 设置树莓派SSH连接因超时闲置断开(转)

    设置树莓派SSH连接因超时闲置断开 转自:http://shumeipai.nxez.com/2013/12/06/set-ssh-connection-is-disconnected-due-to- ...

  3. 解决ssh连接超时时间(ssh timeout)的设置方法

    本文介绍下,linux中ssh连接超时时间的设置方法,以避免总是被强行退出.有需要的朋友,参考下吧.有关修改ssh连接超时时间的方法,网上介绍的很多了.比如下面这个:可以减少ssh连接超时等待的时间: ...

  4. setting>SSH>sessions setting>勾选ssh Keepalive[ MobaXterm】设置保持SSH连接

    [ MobaXterm]设置保持SSH连接 ssh远程连接会在无操作时自动断开连接.为了保持程序运行和连接,需要设置保持连接. 1.MobaXterm如果使用了MobaXterm客户端,那么需要在设置 ...

  5. SSH连接自动断开的解决方法(deb/rpm)

    ######### 修改后的: ## # tail -f -n 20 sshd_config#MaxStartups 10:30:60#Banner /etc/issue.net # Allow cl ...

  6. linux ssh连接超时断连设置

    以下均针对redhat6.5系统进行说明. 一.设置ssh超时断连 使用root用户,编辑/etc/profile文件,在 HOSTNAME='/bin/hostname' HISTIZE=30 后增 ...

  7. ssh连接超时自动断掉的解决办法

    最近开始使用阿里云服务器ECS,系统是CENTOS7.4 ,通过SSH连接上自动创建的实例后,几分钟不操作,就自动断开,提示“信号灯时间已到”,非常影响工作. 解决办法: 默认镜像创建的实例,SSH服 ...

  8. ssh连接超时问题解决方案,每一种方案都可以

    1.服务端修改 vim /etc/ssh/sshd_config 修改 ClientAliveInterval 60 ClientAliveCountMax 40 60秒,向客户端发送一次请求. 超过 ...

  9. SSH连接超时不自动断开

    Putty 启用putty keepalive putty -> Connection -> Seconds between keepalives ( 0 to turn off ),默认 ...

随机推荐

  1. HBase-存储-写路径

    写路径 当用户向HRegionServer发起put请求时,其会将请求交给对应的HRegion实例来处理.第一步是要决定数据是否需要写到由HLog类实现的预写日志中.WAL是标准的Hadoop Seq ...

  2. linux平台及windows平台mysql重启方法

    各个平台mysql 重启: inux平台及windows平台mysql重启方法 Linux下重启MySQL的正确方法: 1.通过rpm包安装的MySQL service mysqld restart ...

  3. SQL server 2008 T-sql 总结

    数据库的实现 1.添加数据:insert [into] 表名 (字段1,字段2,···) values (值1,值2,····)     其中,into可选. 2.修改数据:update 表名 set ...

  4. android、ipone在文本框中输入文字的不同

    1.android机会输入时会在键盘上先显示,你确定后再填充如文本框 2.ipone机是你输入时就直接填充到文本框,当你选择输入信息时,就会先把文本框的内容清空,在填充选择的文字,这时就会有个问题,如 ...

  5. BZOJ2878 [Noi2012]迷失游乐园

    本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/ ...

  6. cos用在什么场景

    随着应用的不断发展,应用过的图片,文件会不断增加, 存储量的提升带来的是IO用量的提升和带宽占用增加 大部分文件属于低频文件,但是占用较大 硬盘的变更需要重启机器 这个循环会造成支出不断增加 为了节省 ...

  7. Overlay网络与物理网络的关系

    编者按:无论是云计算还是SDN都把注意力集中在数据中心网络的建设上,各种解决方案层出不穷,其中以VMware为代表的软件厂商提出Overlay网络方案后,为数据中心网络的发展提出了新的思路.那么Ove ...

  8. 智课雅思词汇---十五、前缀co-com-con-col-cor-是什么意思

    智课雅思词汇---十五.前缀co-com-con-col-cor-是什么意思 一.总结 一句话总结:前缀:co- 表示"共同", 通常放在元音词根前 1.前缀co-com-con- ...

  9. jsp:<c:redirect> 和<c:param> 标签

    redirect 标签使用来进行页面之间的重定向,它和传统 JSP 程序中的<jsp:redirect>标记功能相类似.param 标签是和 redirect 一起使用的,它用来进行参数值 ...

  10. Android项目的目录结构 初学者记录

    Android项目的目录结构 Activity:应用被打开时显示的界面 src:项目代码 R.java:项目中所有资源文件的资源id Android.jar:Android的jar包,导入此包方可使用 ...