Would like to get email alerts when user password going to expire

Hello,

I am trying to write a shell script, which will send email alerts to Admin/users when users password is going to expire in 15 days.
Can you please help me with the script.

thank you.

You should attempt to write your own code / script first; then post what you have written / tried first; to start to discussion.

Welcome kumar7997,

I have a few to questions pose in response first:-

  • Is this homework/assignment? There are specific forums for these.
  • What have you tried so far?
  • What output/errors do you get?
  • What are your preferred tools? (C, shell, perl, awk, etc.)
  • What logical process have you considered? (to help steer us to follow what you are trying to achieve)

Most importantly, What have you tried so far?

Giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.

We're all here to learn and getting the relevant information will help us all. The password details are stored in /etc/security/passwd with the password rules stored in /etc/security/user. You will need to check the last update time against the current time with reference to the rules you have set in order to decide if the password is due to expire within any given period.

I hope that this helps, but if not, show us how far you have managed and explain what is not working, with all code, files input & output/errors wrapped in CODE tags.

Thanks,
Robin

Thanks much Robin.

Actually it was just to simplify my work.(instead of checking manually) Thank you for your post/followup. I should have tried and post the code/content. But anyway found some reference script online and i modified it and used. What ever you've posted above is really helpful in figuring out where to start. I do have system admin knowledge. But not good at scripting.

Next time, I will definitely try and post the question with sufficient data.

Thanks Robin. :slight_smile: