Timeout ssh sessions after inactivity?
        Posted  
        
            by 
                Insyte
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by Insyte
        
        
        
        Published on 2009-07-06T22:32:55Z
        Indexed on 
            2012/11/21
            17:02 UTC
        
        
        Read the original article
        Hit count: 284
        
PCI requirement 8.5.15 states: "If a session has been idle for more than 15 minutes, require the user to re-enter the password to re-activate the terminal."
The first, and most obvious, way to deal with ssh sessions that are idling at the bash prompt is by enforcing a read-only, global $TMOUT of 900. Unfortunately, that only covers sessions sitting at the bash prompt. The spirit of the PCI spec would also require killing sessions running top/vim/etc.
I've considered writing a */1 cron job that parses the output of "/usr/bin/w" and kills the associated shell, but that seems like a blunt instrument. Any ideas for something that would actually do what the spec requires and just lock the terminal? I've looked at away and vlock; they both seem great for voluntarily locking your terminal, but I need a cron/daemon task that will enforce locking.
© Server Fault or respective owner