From time to time and for various reasons, PyTTY loses connection to SSH sessions on my CentOS 7 server (PuTTY is buggy, SSH server is buggy, router has been rebooted, connection is dropped, cable pulled out etc). These abandoned sessions are a burden on the server and consume resources. Could the CentOS 7 SSH server be configured to automatically terminate any SSH session after 24 hours, regardless of session purpose and state?
Why regardless of session purpose and status? Because in my opinion it can sometimes be difficult to distinguish between a normal session and an abandoned session.
First of all, don't run CentOS7. It's EOL
Second, read
man sshd_config
:Setting those to e.g. 3 and 600 respectively will terminate sessions after 3*600 second when the TCP session is dead.