There are two parameters in the SSH configuration file to control idle connection timeout and disconnection. The two parameters are clientalivecountmax and clientaliveinterval.
Set idle SSH connection timeout on solaris10 as follows:
Modify the/etc/ssh/sshd_config file and add the following content to the file: clientalivecountmax = 0 clientaliveinterval = 600 # The unit is seconds and then restart the SSH service: #> svcadm restart SSH
For more information about the two parameters, see 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.
It should be noted that the description in man seems to be wrong. According to the instructions in man, if clientalivecountmax is set to 3 and clientaliveinterval is set to 15, the idle connection should be automatically disconnected in about 45 seconds. However, clientalivecountmax must be set to 0 in actual tests, idle connections can be automatically disconnected.