zoukankan      html  css  js  c++  java
  • Solaris10 如何设置空闲ssh连接超时断开

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

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


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

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

    ClientAliveCountMax
    
             Sets the number of client  alive  messages  (see  Clien-
             tAliveInterval,  below)  that  can  be sent without sshd
             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  session.  It  is  important to note that the use of
             client alive messages is very different  from  KeepAlive
             (see  below). The client alive messages are sent through
             the encrypted channel and therefore will not be  spoofa-
             ble.  The  TCP  keepalive option enabled by KeepAlive is
             spoofable. The client alive mechanism is valuable when a
             client or server depend on knowing when a connection has
             become inactive.
    
             The default value is 3. If  ClientAliveInterval  (below)
             is  set  to  15,  and ClientAliveCountMax is left at the
             default, unresponsive ssh clients will  be  disconnected
             after approximately 45 seconds.
    
         ClientAliveInterval
    
             Sets a timeout interval in seconds after  which,  if  no
             data  has  been  received  from the client, sshd sends 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 only to protocol version 2.
    需要说明的是man里的说明似乎有错误。按照man里面的说明,如果设置ClientAliveCountMax=3,ClientAliveInterval=15,空闲连接应该在45秒左右自动断开,但实际测试时发现必须设置ClientAliveCountMax=0,空闲连接才能自动断开。
  • 相关阅读:
    手机网页唤醒app,
    h5 audio进度条
    js判断字符串与字符串相互包含,以及数组是否包含某个元素;
    vue cli 打包项目造成css背景图路径错误
    vue-cli webpack打包不.map文件,iview 项目打包完,图标路径有问题
    常用的活动榜单
    vue-cli的webpack模板项目配置文件分析,配置信息详解
    eclipse怎么debug项目
    什么是前置机,前置机的作用是什么
    jsp中连接数据库及实现增删改查
  • 原文地址:https://www.cnblogs.com/cqubityj/p/3857904.html
Copyright © 2011-2022 走看看