1753521 Members
6392 Online
108795 Solutions
New Discussion юеВ

User idle time

 
SOLVED
Go to solution

User idle time

How can I kick out users that are over an hour idle. A lot of my users don't log out at all. I know I can kick them out individually but wanted to know if there is some kind of setting out there that I am unaware of.
3 REPLIES 3
Tim Malnati
Honored Contributor
Solution

Re: User idle time

I don't know of any automated command to do this, but here are some thoughts... There is an inherent danger with logging people out of a machine. Who knows what type of processing they are/have been performing. For example, they could be in some data entry screen within a RDBMS where the execution point there sitting on may not have written to all the required files. One hour idle time may seem long but I think it's a bit short when you consider the potential ramifications. A better method may be to log off inactive user processes when you perform your daily backups. The preferred method would be to use kill -1 (SIGHUP). My strong suggestion would be to discuss the issue with your DBA's and application developers before you set anything in stone. It's a good chance that they are the worst culprits to which the best solution is to relegate them to a separate test machine.
Thomas G. Tudrej
Frequent Advisor

Re: User idle time

Hello,

For telnet sessoins you can try setting "TMOUT" shell variable in .profile to some number of seconds. Idle sessions will get dropped after specified period. Works for sure with ksh.

Regards,
TT
Alan Riggs
Honored Contributor

Re: User idle time

Both good answers. If you simply must find users to boot on the basis of idle time, then you can parse the value out of w (or uptime). This works for any users that connect through a standard login shell, but it will not find users that hit the box through an applications socket which does not spawn a shell session.

One note: make sure to select processes to kill based upon tty, not userid, since a user may have multiple logins open.