Bash script to notify users that password is about to expire
Posted on 2009-04-18
I need some help creating a scrip to email users that their password is going to expire in 7 days. I have been able to get a file with username, passwordlastchanged time and email address all on one line. For example:
fred 20090101 firstname.lastname@example.org
john 20090102 email@example.com
chris 20090103 firstname.lastname@example.org
and so on
I now need a bash/awk script that will read each line one by one and if the password is greater than or equal to 83 days (90 days -7 for warning,,) send the user a email. If it is less than 83 days don't send the user a email.
We're running Centos 5.2. The reason for this is that some of our users never log into unix boxes so they don't know that their password is about to expire. Other users that DO log into linux boxes have no problems because they are notified on the command line. BTW, I forgot to mention that we are using LDAP for authentication of both linux boxes and some network devices.
I need this ASAP, I tried but could not figure it out all the way. I'm very new to bash scripting. Any help would be greatly appreciated.