Logging out idle users after a certain timeframe


 
Thread Tools Search this Thread
Operating Systems Solaris Logging out idle users after a certain timeframe
# 1  
Old 06-01-2010
Logging out idle users after a certain timeframe

We recently underwent a security audit and have a new requirement to not allow users to stay logged on overnight. In order to place this policy into effect i need a way to check for idle users and log them off. Is there any good way to enforce this policy in Solaris 10 and make it work in such a way that only users are logged out and other accounts are not affected?
# 2  
Old 06-01-2010
TMOUT
# 3  
Old 06-01-2010
There is a TMOUT variable you can define readonly in /etc/profile -

ksh example:
Code:
typeset -r TMOUT=14400

bash:
Code:
readonly TMOUT=14400

This sets the idle timeout to 3 hours. Any idle process will simply logout after three hours of idle time.
# 4  
Old 06-01-2010
Thanks for the replies, I'm looking for something more along the lines of a cron job that will run at 6, 9, and 12 and log off any idle users found during that timeframe.
# 5  
Old 06-01-2010
Well, the nuclear option that you're suggesting for yourself would be for a root or superuser to kill any jobs associated with non-Admin and higher GIDs...every 3 hours. For this to work, you'd need to identify the PIDs associated with these GIDs and work backwards from there. Gritty...and dangerous.

For example, what if little Cindy Lou Who signs on and is working on a time-critical item...only to be killed based on your cron job? The loss in her time alone might be sufficient to raise alarms, if it doesn't corrupt data as a result as well. Tack on the likelihood that it happens after-hours, after she's just signed in at 1135pm, on New Year's Eve while she's been ordered to do so from the corner office...and it spirals from there.

TMOUT, on the other hand, will serve to neutralize lingering sessions where the User has been idle (ie, not actually working) for a specified amount of time. Their own passivity serves the purpose to allow the system to sign them off; sort of like banking websites. It's a rolling window that resets according to their login time and their activity. Imagine if banks took the aggressive approach and nixed your session while you were still setting up a transfer to your offshore account? (All those fractions of cents add up, you know...)

I'd strongly suggest that you at least apply the TMOUT option first and see if would suit the audit requirement. Something that works, as opposed to a whiz-bang script written from the ground up, might just suit the requirement perfectly...with zero effort.
This User Gave Thanks to curleb For This Post:
# 6  
Old 06-02-2010
Quote:
Originally Posted by curleb
Well, the nuclear option that you're suggesting for yourself would be for a root or superuser to kill any jobs associated with non-Admin and higher GIDs...every 3 hours. For this to work, you'd need to identify the PIDs associated with these GIDs and work backwards from there. Gritty...and dangerous.

For example, what if little Cindy Lou Who signs on and is working on a time-critical item...only to be killed based on your cron job? The loss in her time alone might be sufficient to raise alarms, if it doesn't corrupt data as a result as well. Tack on the likelihood that it happens after-hours, after she's just signed in at 1135pm, on New Year's Eve while she's been ordered to do so from the corner office...and it spirals from there.

TMOUT, on the other hand, will serve to neutralize lingering sessions where the User has been idle (ie, not actually working) for a specified amount of time. Their own passivity serves the purpose to allow the system to sign them off; sort of like banking websites. It's a rolling window that resets according to their login time and their activity. Imagine if banks took the aggressive approach and nixed your session while you were still setting up a transfer to your offshore account? (All those fractions of cents add up, you know...)

I'd strongly suggest that you at least apply the TMOUT option first and see if would suit the audit requirement. Something that works, as opposed to a whiz-bang script written from the ground up, might just suit the requirement perfectly...with zero effort.
Given your argument and other considerations I'll go ahead and try the bash option first and if that doesn't work then I'll try something else.

---------- Post updated at 10:26 AM ---------- Previous update was at 08:26 AM ----------

Setting the TMOUT varialbe works but does not really accomplish what i want to accomplish. It closes the active terminal windows but does not accomplish a logout of the user. Is there no way to logoutout the user after a certain timeframe?
# 7  
Old 06-02-2010
Quote:
Originally Posted by goose25
Setting the TMOUT varialbe works but does not really accomplish what i want to accomplish. It closes the active terminal windows but does not accomplish a logout of the user. Is there no way to logoutout the user after a certain timeframe?
It would help then if you tell how the users do log in and what these non terminal windows you are referring to are.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Telnet sessions stay as idle users

Hi The telnet sessions stay as idle users. It is not getting kicked out. Please advise what could be the issue. only when we reboot the server these telnet sessions goes. Below is the current output from the server. we rebooted the server three days ago: pmut6:/> uptime 04:21PM... (8 Replies)
Discussion started by: newtoaixos
8 Replies

2. HP-UX

kill idle users

Hi, In my network we uses the NetTerm program to connect us to HP-UX 10.x server from windows workstations, but in some cases the user doesn't logout and close it by window's x button. The problem is that in HP-UX the user and all his tasks remain active and when he enter again HP-UX creates a... (12 Replies)
Discussion started by: efrenba
12 Replies

3. Shell Programming and Scripting

Killing idle users TIA

I wrote a script to kill users idle more than 1/2 hour, ignoring those in an exception list. Here is the script as it is now: #! /usr/bin/awk -f BEGIN { system("who -u | sort +5 > /tmp/loginfile"); system("echo User Sessions Killed > /tmp/killedlogins"); ... (2 Replies)
Discussion started by: PapaBear
2 Replies

4. UNIX for Advanced & Expert Users

HP-UX users get logged off while idle.

Im "supporting" at least 2500 HP-UX workstations with CAD-related software with the B.11.11 build. I cant say anymore than that because of my companys sligtly paranoid security policy . The last few days a new problem has arised from nowhere. The problem is that users gets logged off when the... (5 Replies)
Discussion started by: Laoinjo
5 Replies

5. Shell Programming and Scripting

i need a scipt to email users with idle processes!?

hello, i am VERY new to this whole script world. I need to come up with a script that will email a user if they have an idle process past 500 minutes...any suggestions??? Thanks so much. (0 Replies)
Discussion started by: sheppy28
0 Replies

6. Shell Programming and Scripting

Idle users over 1 day

Please help, im modifing an idle script to capture (not kill) users who havee been idle over a time. now i've got to work with the exection of users whos idle time gove over 24 hrs and becomes "old". please advice on how to correct... #Clear old report, generate new data and new report echo "\n... (1 Reply)
Discussion started by: pbonilla
1 Replies

7. Shell Programming and Scripting

script for killing idle users

I need a script that will look for idle users and kill there proc. (7 Replies)
Discussion started by: jdel80
7 Replies

8. Shell Programming and Scripting

finding idle users

I am trying to write a script that will list the idle users on my system which is running HPUX 11.11. The script is currently written as : who -u > /home/rfm/scripts/user.txt echo " There are currently... " wc -l /home/rfm/scripts/user.txt echo " User logins on System : `uname -n` ... (3 Replies)
Discussion started by: rfmurphy_6
3 Replies

9. AIX

Log off idle users

How to set a timer for log out users that have been idle for a long time? It is a AIX 5L (0 Replies)
Discussion started by: wtofu
0 Replies

10. HP-UX

Is there a script available to kill Idle users

My max user parm is set to 1050. I'm currently at 1038 this is causing major slow downs on the server. I looking for a way log off "idle" user logins with out having to do it individually. :confused: (5 Replies)
Discussion started by: rfmurphy_6
5 Replies
Login or Register to Ask a Question