Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!decwrl!sgi!wiltse@oceana.esd.sgi.com From: wiltse@oceana.esd.sgi.com (Wiltse Carpenter) Newsgroups: comp.sys.sgi Subject: Re: cron and logins Summary: Use /etc/profile and /etc/cshrc to check times Message-ID: <45294@sgi.sgi.com> Date: 28 Nov 89 03:04:52 GMT References: <8911242042.aa26144@SMOKE.BRL.MIL> <1636@odin.SGI.COM> Sender: wiltse@oceana.esd.sgi.com Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 31 In article <8911242042.aa26144@SMOKE.BRL.MIL> S090726@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@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