On Tue, Jun 21, 2022 at 02:02:38PM +0200, Conti Stefano wrote: > Excuse me but i sure you that i use this practice from many years and > always work in the past. I've a other distro, an "old" Debian 9 and a > Centos 7 with SSH version 7.4p1 and i'm sure work all well because i > put ClientAliveInterval 15 and after 15 seconds SSH session closed!
sshd_config(5) says: ClientAliveInterval Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send 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. Nothing here relates to *idle* sessions. If you scroll up to the previous section: ClientAliveCountMax Sets the number of client alive messages which may be sent with‐ out sshd(8) receiving any messages back from the client. [...] The default value is 3. If ClientAliveInterval is set to 15, and ClientAliveCountMax is left at the default, unresponsive SSH clients will be disconnected after approximately 45 seconds. Setting a zero ClientAliveCountMax disables connection termina‐ tion. This still doesn't relate to idle sessions. It's there to remove *non-responsive* sessions -- ones where the client has crashed, or where the network connection between the client and server has stopped transmitting packets.