在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. MapReduce-从HBase读取数据处理后再写入HBase

    MapReduce-从HBase读取处理后再写入HBase 代码如下 package com.hbase.mapreduce; import java.io.IOException; import o ...

  2. HDFS数据完整性

    数据完整性 Hadoop用户肯定都希望系统在存储和处理数据时不会丢失或损坏任何数据.尽管磁盘或网络上的每个I/O操作不太可能将错误引入自己正在读/写的数据中,但是如果系统中需要处理的数据量大到Hado ...

  3. Python快速学习-高级特性

    1.切片 取一个list或tuple的部分元素是非常常见的操作 L = ['hello','the','world','and','my','love'] 取前三个元素 L[0:3],L[:3] 取倒 ...

  4. tensorflow笔记:流程,概念和简单代码注释

    tensorflow是google在2015年开源的深度学习框架,可以很方便的检验算法效果.这两天看了看官方的tutorial,极客学院的文档,以及综合tensorflow的源码,把自己的心得整理了一 ...

  5. VS2010 + QT 5 +open inventor 环境配置

    本科毕业设计做的是   随钻测量的井眼轨迹和测井曲线的三维显示  要求的环境是  QT +  Open Inventor    在寒假开学前,打算将环境配置好,开学后再正式编码实现,可是....环境也 ...

  6. JProfiler远程监控 -转

    1. 服务端安装JProfiler(与客户端版本一致) 2. 客户端配置连接: A).session——integration wizards——New remote integration B).选 ...

  7. Chrome Adobe flash player已过期怎么办

    越来越多的朋友感受到了来自谷歌chrome新版浏览器的压力,因为有不少朋友在使用新版chrome浏览器看视频时,却出现了这样的提示:Adobe flash player已过期!怎么办啊? 有网友抱怨: ...

  8. 《领域驱动设计 C# 2008 实现》 - 书摘精要

    (P2) 智能客户反模式被 Eric Evans 定义为“把所有业务逻辑放进用户界面.把系统分解成小函数,作为分离的用户界面实现,并在里面嵌入业务规则.使用关系数据库作为共享的数据仓储.使用现有的自动 ...

  9. js改变select的选中项不触发select的change事件

    // test var selectEl = document.querySelector('select') var buttonEl = document.querySelector('butto ...

  10. Linux命令学习(18):route命令

    版权声明更新:2017-05-20博主:LuckyAlan联系:liuwenvip163@163.com声明:吃水不忘挖井人,转载请注明出处! 1 文章介绍 本文介绍了Linux下面的route命令. ...