Being *Smart* with the shadow file ???

From: Spook (spectre_at_xtra.co.nz)
Date: 07/06/05


Date: 5 Jul 2005 18:20:23 -0700

Hello All,
It's late in the day and my mind is weary...

I'm trying to write a script to calculate that a user's password is
about to expire in 3 days and the script that will run daily will do a
`passwd -f $userid` so that when s/he logs in the next day s/he will be
forced to change password.

Reason I'm doing this is that currently the users get sent directly to
a Oracle FORMS menu dictated by their .profile when they login. They do
not even see the $>prompt to change password.

So now I see that the third entry (lastchg) in the /etc/shadow file
pertains to when the user last changed their passwd from UNIX epoch of
January 1, 1970.

Now this is making my head spin on how I'm going to write a shell
script to calculate the date stamp on the shadow file and the current
date.

My initial plan was to extract the userid and date from the `passwd
-sa` and some how compare todays date and the last change + 3 months
date.

testuser PS 07/05/05 90 70

Example: I would set variable $A = the last change date 07/05/05 and
add 3 months as required... so the month of 07 to 10 .

A="10/05/05"
B=`date '+%D'`

So now ...
  If [ $A == $B ]; then
  passwd -f $userid
  fi

Well that's my current plan...but I still think trying to figure out
how to calculate using UNIX epoch would be the way to go...

Thanks in advance...



Relevant Pages

  • Re: Being *Smart* with the shadow file ???
    ... > I'm trying to write a script to calculate that a user's password is ... > not even see the $>prompt to change password. ... > script to calculate the date stamp on the shadow file and the current ... > how to calculate using UNIX epoch would be the way to go... ...
    (comp.unix.solaris)
  • Re: Being *Smart* with the shadow file ???
    ... > I'm trying to write a script to calculate that a user's password is ... > not even see the $>prompt to change password. ... > script to calculate the date stamp on the shadow file and the current ... > how to calculate using UNIX epoch would be the way to go... ...
    (comp.unix.shell)
  • Re: Password complexity..domain policy
    ... The script that does that forces user to change password on next login is ... Schedule this script as a task to run after few days (under account that has ... >>> so when would this policy apply to existing users?? ...
    (microsoft.public.win2000.active_directory)
  • Being *Smart* with the shadow file ???
    ... I'm trying to write a script to calculate that a user's password is ... `passwd -f $userid` so that when s/he logs in the next day s/he will be ... not even see the $>prompt to change password. ... how to calculate using UNIX epoch would be the way to go... ...
    (comp.unix.solaris)
  • Re: Form Submit Button Question
    ... Javascript Onclick event on each button to set form.action. ... When I hit ENTER on the computer keyboard, ... Firefox choose the "Change Password" button (I assume because it is the ... The script uses the $_POSTvalue to determine what to do as there are three different forms on the page. ...
    (comp.lang.php)