time dependent login

Robert E. Stampfli res at cbnews.att.com
Fri Jun 1 03:29:36 AEST 1990


>  I want to enable login to a certain userid only during certain times.
>Assume that cron can run a program to enable or disable, and that I can
>do this as root if need be. Given that, is there an elegant way to
>enable a login only during certain times, and to do so in a way which
>doesn't lead to possible timing problems or other system uglyness, such
>as editing the password file directly?

Why *not* modify the password file?  To turn an account "xyz" off:

/bin/echo '/^xyz:/s/:/:NOLOG/\nw' | /bin/ed /etc/passwd

To turn it back on:

echo '/^xyz:/s/:NOLOG/:/\nw' | /bin/ed /etc/passwd

-- 
Rob Stampfli	/ att.com!stampfli (uucp at work) / kd8wk at w8cqk (packet radio)
614-864-9377	/ osu-cis.cis.ohio-state.edu!kd8wk!res (uucp at home)



More information about the Comp.unix.wizards mailing list