sudo sed -i 's/^#ClientAliveInterval.*/ClientAliveInterval 300/' /etc/ssh/sshd_config
Drop SSH connections idle for five minutes
ClientAliveInterval 300 makes the server send keepalives every 300 seconds and disconnect clients that never answer — cleaning up abandoned sessions that otherwise hold connections and processes. This is the server-side counterpart to the client's ServerAliveInterval. Choose a value larger than your slowest legitimate operation.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.