System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

E-mail when account is about to expire

SOLVED
Go to solution
Victor Semaska_3
Esteemed Contributor

E-mail when account is about to expire

Greetings,

I've searched the forum but didn't find anything. I would think this to be something somebody would want.

Our DBAs complain that on occasion they try to log onto a server to find their account locked because the password expired. This happens because there are many servers and they often don't log onto a server for long periods of time.

What they want is to have an e-mail sent to them when the password of an account on a server is about to expire. Like a few days notice.

I was wondering if anyone had a script and/or program that would do this. We're running Tru64 V5.1B PK4. We have Enhanced Security enabled.

If there's no such script/program I was thinking of trying to write a script myself. Here's the basic logic. Any thoughts are welcomed.

1) Get the u_succhg for the account using edauth. This gives the last succesful change of the password.

2) Get the u_exp for the account. If it doesn't exist get it from the default record (edauth -d d -g default).

3) Add the 2 no.s together to get the time the password expires.

4) Somehow convert those seconds into a date. I know of one way with the commands:
echo "ctime 1100524315" | kdbx -k vmunix|tail -1

5) Finally compare that date with the current date to determine whether an e-mail shoud be sent.

Thanks,
Vic
There are 10 kinds of people, one that understands binary and one that doesn't.
2 REPLIES
Hein van den Heuvel
Honored Contributor
Solution

Re: E-mail when account is about to expire

Sounds about right. kdbx is a big hammer perhaps.
I would possibly use the perl localtime function to convert time in seconds to a date. And perl will happily do the math, subtract days, send mail, whatever.
Basic example:

perl -e '$day=86400; print scalar localtime(1100524315-5*$day)'

fwiw,
Hein.
Victor Semaska_3
Esteemed Contributor

Re: E-mail when account is about to expire

Hein,

Thanks for the logic review and the suggestion to use Perl to convert the time. I was able to write a script to do what I want and it seems to work.

Vic
There are 10 kinds of people, one that understands binary and one that doesn't.