首页 > 代码库 > Solaris10 如何设置空闲ssh连接超时断开
Solaris10 如何设置空闲ssh连接超时断开
在ssh的配置文件中有2个参数可以控制空闲连接超时断开。这2个参数是ClientAliveCountMax和ClientAliveInterval。
Solaris10上设置空闲ssh连接超时断开的方法如下:
修改/etc/ssh/sshd_config文件,在文件中加入以下内容:ClientAliveCountMax = 0ClientAliveInterval = 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.
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。