cron and logins

Wiltse Carpenter wiltse at oceana.esd.sgi.com
Tue Nov 28 14:04:52 AEST 1989


In article <8911242042.aa26144 at SMOKE.BRL.MIL> S090726 at UMRVMA.UMR.EDU ("Bob B. Funchess") writes:
>I want to set up a system on our 4D/20 where certain users can only login
>at certain times, such as non-prime hours.  The only way I can think of to
>do this is to have cron swap /etc/passwd in and out at these times, and
>frankly this frightens me a little :).  Does anyone have such a setup?
>Will you share your secrets?  You can mail me direct at the address below...
>
>
>                             < Bob  S090726 at UMRVMA.UMR.EDU  Funchess >

Some of the solutions suggested here could have ill effects if the
user was logged in at the time change.  A solution that doesn't
require and funny cron entries would be to write a program that
performs the time checking and use it as a predicate in the /etc/profile
and /etc/cshrc files.  For instance, in /etc/profile do something
like:

if check_login_time
then
	echo "This is not a good time to log in.  Try again later."
	sleep 20
	exit 0
fi

The /etc/profile and /etc/cshrc are shell scripts that are executed
by /bin/sh and /bin/csh whenever a user first logs in (or does an
su - user).  This is a better place to put this sort of thing than
changing /etc/passwd on the fly (which has many, many potential
pitfalls).

	-Wiltse Carpenter



More information about the Comp.sys.sgi mailing list