On our Debian servers, I want to ensure that any SSH connections time out and disconnect after 8 hours. This was recommended by our security consultant.
I executed these steps:
# Log in as root then:
sudo vi /etc/ssh/sshd_config
# Use / to search for and change:
ClientAliveInterval=3600
ClientAliveCountMax=8
# Second parameter is number of hours before connection times out and drops.
# Then test config:
sudo sshd -t
# Restart
sudo systemctl restart sshd
However, the tests failed. When I temporarily set ClientAliveInterval=120
and ClientAliveCountMax=2
and restarted the sshd daemon, I would expect the connection to drop after 4 minutes of inactivity. However, it did not.
Any ideas?