SUMMARY: idle users

From: Ashok Sharma (asharma@tssc.wlg.nec.co.jp)
Date: Sun Dec 11 1994 - 22:10:55 CST


Many many thanks to those who responded to my original question:-
   
> Hi Managers
>
> Is there a public software available for SunOs 4.1.3
> that will logout users who are idle for a specified time.
>
> Cheers
> Ashok
>

I was really impressed with the options provided by idled program,
but unfortunately,
it does not compile on SunOs (not yet!!).
I am trying out the different options to see which will suit my organisation.
Thanks again for all the help.
Happy holidays
Ashok
--------------------------------------------------------------------------------

Here are the replies...

From: Dave Curado <Dave.Curado@HK.Super.NET>

You can just use their shell... if you use ksh or tcsh they have
this ability built right in.

davec
HK Supernet

From: phj06@bk.dk (Paul Hostrup-Jessen)
Hello Ashok,

All you need to do is to set this environment in the .cshrc, .tcshrc or .kshrc
files (depending on the shell in use) residing in each user's home directory:

setenv autologout=xxx

- where xxx is equal to the number of idle minutes.

I usually choose 480 minutes which is equal to a normal 8-hour working day in
Europe, but in Japan you have much longer working hours ....

Best regards

Paul Hostrup-Jessen

From: jipping@cs.hope.edu (Mike Jipping)

We just came out with some...Here's the README.

===========================================
                            Idled -- Idle "Demon"

                                  Version 1.00
                                        
                          Written by Michael P. Crider

                        with guidance from Mike Jipping

                        Hope College -- Holland, MI USA

                                Based on Untamo

INTRODUCTION

        Idled is a "demon" that runs on a machine to keep an eye on current
users. If users have been idle for too long, or have been logged on for
too long, it will warn them and log them out appropriately. The types of
checks that idled performs are the following:

        idle: If a user is idle more than their allotted time, as
                  specified by the idled configuration file, he/she will be
                  warned. If no action has taken place during the warn
                  time, the user will then be logged out.

        session: If a user is logged on for longer than the allotted
                  time, he/she will be warned and logged out in 'sleep'
                  seconds if the user is still logged on then.

        multiple: If too many user sessions are active (ie. many users
                  logged on, or some users logged on many times), idled
                  will choose 1 session for each user to keep, will
                  warn the others, and log those out in 'sleep' seconds
                  (such as 120) if there are still too many logged in
                  then. **** See TODO file! ***

        refuse: If a user matches this setting, idled will terminate
                  the user's session after about a 5 second warning.
                  The basically "refuse"s access for that user (or
                  tty, or group) to the machine, though there may be
                  some time allowed when idled is sleeping between
                  checks.

FEATURES

        Idled is configurable without recompilation for its settings, such
as the maximum allowed idle times, session limits, thresholds before
session limits and multiple login checks begin, and also the important
exemption lists. The configuration file is automatically re-read every
'sleep' seconds (specified in the configuration file). If the
configuration file missing or contains errors when idled attempts to update
its configuration, it will simply report the errors to its log file and
continue normal operation, either with its previous settings (in the event
of the file not being there or not being readable) or with all valid
settings (in the event of errors in the conf file). Idled must exit,
however, if the configuration file is doesn't exist or is not readable when
it first starts, and will also exit at the start if there are errors in the
configuration file (since they should be fixed then).
        Exemptions can be set for any user, group, or tty for any of the
checks that idled performs, such as allowing idle timeouts to default to 60
minutes for everyone, but exempting the 'staff' group from these timeouts.
        Idled has the ability to handle the console as special, so that
X-Windows environments can have appropriate settings. The special handling
includes giving an idle time for the console, with checking for activity by
checking the keyboard and mouse (if in X-Windows), allowing the person on
console to be exempt from idle logins on that machine, and checking to see
if the person on console is running xlock (or some terminal locking
program--the name is configurable at compilation time) and logging the user
off if the xlock program runs longer than the allowed console idle time.
The special xlock check prevents users from running xlock and leaving the
terminal for a long period of time, but not getting logged off, since other
users may press a key or move the mouse to see if the machine is available,
and in doing so makes the logged in user no longer idle. See TODO file for
a comment on xlock.
        The configuration file's path may be specified on the command line,
so that one executable can be used on multiple machines with different path
structures.

ACKNOWLEDGEMENTS

        Idled was heavily based on the code from Untamo 3. We give many
thanks to Craig Bishop of Deakin University for his rework of the original
Untamo, as well as many thanks to Andy Wilcox and Marc Megel of Purdue
University for their hard work on the original Untamo. Idled certainly
would not have all the functionality it has if it was not for these people.

AVAILABILITY
        The newest version of idled is available via anonymous ftp to
ftp.cs.hope.edu in /pub
        All comments and suggestions for idled would be greatly appreciated
and should be sent to crider@cs.hope.edu

From: dworrell@isnet.is.wfu.edu (David Worrell)

I wrote the following script to logout (kill) modem users that were idle
for 20+ minutes. I put in cron at 10 minute intervals. You will have to
modify as I was searching for optima which identified modem users.

#!/bin/sh
#
# Monitor modem lines for idle times > 20 minutes and kill login shell
#
for USER in `finger | grep optima | nawk '{ \
        IDLE=substr($0,35,4); \
        if (IDLE != " ") { \
                if ((IDLE ~ ":") || (IDLE ~ "d")) \
                        print $1; \
                else { \
                        if (substr(IDLE,3,1) >= "2") \
                                print $1; \
                } \
        }
}'`
do
        PID=999999
        for SHPID in `ps -aux | grep "^$USER " | grep sh | awk '{print $2}'`
        do
                if [ $SHPID -lt $PID ]
                then
                        PID=$SHPID
                fi
        done
        if [ $PID -lt 999999 ]
        then
                kill -9 $PID
        fi
done
exit
                else { \
                        sprintf(IDLEN,"%d",IDLE); \
                        if (IDLEN >= "20") \
                                print $1; \
                } \

From: jwc@icf.hrb.com

I just found this in the News group comp.sources.unix. I have not built it
yet, since I just found it yesterday. Good luck.
idled.shar

John

Dan Schlitt School of Engineering Computer Systems

Sure, there are lots of such programs. But are you sure that you want to
do this. This sort of thing works fine when users are connected by
serial lines. But even in this case it has problems and I stopped doing
it and depended on user education.

In the case of serial lines it is hard to tell what "idle" means. One
reason why I stopped was that people were doing kermit file transfers.
Kermit opens /dev/tty for its control. This means that even though there
is active work going on the controling terminal looks idle.

The situation is even worse when people are using ptys. Just because I
am not reading or writing in a window does not mean that it is not in
use. I may be refering to the material displayed in that window while I
work in a different window. If you routinely kill the "inactive" window
you are going to have a very unhappy user on your hands.

The problem with people going away and locking the dispaly is a much more
serious problem. As the message concerning that problem indicated, users
find ways around technical solutions. The best solution to these
problems is user education and cooperation.

/dan

-- 

Dan Schlitt School of Engineering Computer Systems dan@ee-mail.engr.ccny.cuny.edu City College of New York

From: Scott Spevacek <spev@badger.state.wi.us>

There's a timeout program written by Andrew Rudoff in the appendix of the book UNIX_System_Administration_Handbook by Nemeth, Snyder and Seebass. It was originally written as a voluntary timeout program, where the user can set the amount of time that the system will allow them to remain idle before logging them out. It reads the number of idle minutes allowed from the command line, but you could hardcode it into the program. It is usually executed at login time from the .login or .profile script. I use it on a public access account and it works quite well.

Hope it helps, Scott

From: Jieming Zhu <jzhu@helios.wichitaks.NCR.COM>

It may depend on a specific shell. In tcsh, for example, the shell variable autologout stores the number of minutes a shell can stay inactive.

From: Jeb Weisman <weisman@pacificu.edu> Ashok,

This is a tough one. There are a number of packages, but each may not work under certain circumstances. I've found that a program called sps does well, but you also have to compile and run a few other programs along with it. One is called off, the other is called zap. I believe they were originally found at Berkeley.

Some folks will recommend using tcsh as a shell and invoking it's time out variable. It's a nice idea but may not work if you are running something like Pine. At least that's what we've found. For us, after much experimenting, the sps/off combo worked best.

-Jeb

From: "Todd C. Miller" <Todd.Miller@cs.colorado.edu>

Check out idled-1.00. It was recently posted to comp.sources.unix and appears to do what you want. Please note that I have not tried this, I just remembered seeing it go by :-)

- todd

From: Kai Grossjohann <grossjoh@groucho.informatik.uni-dortmund.de> Subject: idle users

Try untamo, available from

ftp.germany.eu.net:/pub/sysadmin

among other places.

\kai{}

PS: I don't use untamo, I just know that it exists.

From: aurelio@marajo.ufpa.br (Aurelio Ramalho)

Use tcsh, it have autologout feature ...

Thnx,

-- Aurelio Ramalho E-mail: aurelio@marajo.ufpa.br

Herve DEMARTHE E-Mail: demarthe@alpha.cad.cea.fr

Dear Ashok,

I think that the Korn shell (ksh) has this feature, but it may be a big change for your users moving to ksh. Advantage : it's free !

Regards, +--------------------------------------------------------------+ | Herve DEMARTHE %^) E-Mail: demarthe@alpha.cad.cea.fr | | CEA/DSM/DRFC/STEP Tel: +33 42257527 Fax: +33 42252661 | | CEN Cadarache Bt 506 13108 St Paul Lez Durance FRANCE | +--------------------------------------------------------------+



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:16 CDT