On a Linux system with
bash as a default shell, I want to configure automatic logout with the following criteria:
- Console sessions (VGA, serial, remote KVM, etc.) are logged out after a specified period of time
- Console sessions are logged out even when running "non-idle" processes such as
- SSH sessions are not logged out in this fashion
The intent is to ensure that no console sessions, whether over VGA or remote KVM or serial, are left logged in by accident. I want to ensure this across our site.
TMOUT environment variable doesn't quite serve my needs due to the second bullet.
I could work out a quick solution that kills
login processes of a certain age, but that seems brittle and prone to side effects. I could look for shells whose
/proc/$PID/fd/0 link to a
This seems like a problem that must have been solved already, though. Any pointers as to how this is accomplished are much appreciated.