Re: how to check the password expire date for individual users (665 Views)
Reply
Super Advisor
rajesh73
Posts: 448
Registered: ‎03-17-2009
Message 1 of 8 (709 Views)

how to check the password expire date for indual users

how to check the password expire  date for indual users

 

 

Acclaimed Contributor
Dennis Handly
Posts: 25,290
Registered: ‎03-06-2006
Message 2 of 8 (707 Views)

Re: how to check the password expire date for individual users

What type of passwords so you have?  Standard, trusted, enhanced?

With standard, you can use logins: -x -l user1,user2

Unfortunately the result is a DDMMYY last password changed value and a number of days until it expires.

 

Super Advisor
rajesh73
Posts: 448
Registered: ‎03-17-2009
Message 3 of 8 (705 Views)

Re: how to check the password expire date for individual users

Hi,

please find the below output

unix1$logins -x -l rajesh
rajesh 113 admin 105
/home/rajesh
/sbin/sh
PS 030812 0 182 7

we required password expire for trusted system
Super Advisor
rajesh73
Posts: 448
Registered: ‎03-17-2009
Message 4 of 8 (695 Views)

Re: how to check the password expire date for individual users

# /usr/lbin/getprpw -m expwarn rajesh
expwarn=-1

what is the meaning for expwarn
Super Advisor
rajesh73
Posts: 448
Registered: ‎03-17-2009
Message 5 of 8 (692 Views)

Re: how to check the password expire date for individual users

please find below is my requirment

 

i need to set a alert mail , whenever password expire time reach, sent mail to perticular user automatiicaly

Acclaimed Contributor
Dennis Handly
Posts: 25,290
Registered: ‎03-06-2006
Message 6 of 8 (672 Views)

Re: how to check the password expire date for individual users

>PS 030812 0 182 7

 

This says the password was reset today (Mar 8) and will expire in 182 days, 26 weeks or about 6 months.

 

>whenever password expire time reach

 

You search the forum for similar requests.  Otherwise you need to do date arithmetic on the above date and duration.  perl will work wonders here.

Super Advisor
rajesh73
Posts: 448
Registered: ‎03-17-2009
Message 7 of 8 (668 Views)

Re: how to check the password expire date for individual users

their is any other way to check the user password expire date
Honored Contributor
Matti_Kurkela
Posts: 6,271
Registered: ‎12-02-2001
Message 8 of 8 (665 Views)

Re: how to check the password expire date for individual users

> what is the meaning for expwarn

 

If expwarn is set to "-1", it means "use the system-wide expwarn value". The output of the "logins" command reveals that the system-wide expwarn value in your system is 7 days.

 

If expwarn is set to any other non-zero value, it means the time (in days) the system warns the user at login time when the password is about to expire.

 

For example, if the user's password would expire on 14 March and expwarn is set to 14, on 1 March and after that the user will see the message "Your password will expire in NN days." when s/he logs in, until s/he changes the password or the password actually expires.

 

> PS 030812 0 182 7

 

The script would need to convert the MMDDYY date 030812 to an Unix timestamp, add  15724800 seconds to the timestamp value ( password max age: 182 days * 24 hours/day * 60 minutes/hour * 60 seconds/minute = 15724800 seconds), subtract the desired warning time, and compare the result to the current Unix timestamp.

 

The result would be the timestamp when the script should start warning the user: if it is greater than the current timestamp, there is no need to warn that user yet. If the result is less than the current timestamp, the warning should be sent.

 

If you want to generate a human-readable password expiration date, just convert the password setting date to Unix timestamp and add the password max age to it as above, and convert the result to a human-readable date.

 

This should be be an easy task for anyone who can write Perl scripts, as Perl has built-in functions for converting human-readable dates to Unix timestamps and vice versa.

MK
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.