[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Password Expiry format



Quoting James A. Peltier (james_(_at_)_site-fx_(_dot_)_net) from  9 December 2002:
> I'm trying to implement password expiry for some of my accounts and 
> cannot figure out the format for useradd or usermod.  Can someone please 
> tell me:
> 
> 1) how to force a password change every 28 days using either useradd or 
> usermod
> 2) if it is possible how to set it to change on the 28th of the month.
> 
> i've tried usermod -e +2419200 user hoping it would just add 28 days to 
> the current date as well as numerous others to no avail.

here is a bit of an explanation of how the dates are expected.. 
I know this isn't really an answer to the implementation details
but I have other things to worry about right now (like finals ;-)

-e expects the date in %c format. That means something along the 
line of "Mon Dec 13 12:23:05 2002". The weekday does not matter as it
gets passed to mktime eventually which ignores it. 

Really though, you want -f I believe. -e is an account expiration 
field, -f is password expiration from quickly looking back at user.c.
This is actually documented incorrectly in user.c.

-f expects the date in seconds from the epoch.


user has a pretty terrible interface imo.. some of this may be 
addressed if anyone wants to spend the time copying some of the 
commits done to NetBSD's user in the past few months. They've 
changed -e & -f to use a slightly more consistent date scheme
("month day year")

I may spend a little more time with it in a week or three if 
no one else has. Right now though, I have a final exam in a day
or two and I really should probably study ;-)

Good luck,


-b