Operating System - HP-UX
1748265 Members
3634 Online
108760 Solutions
New Discussion

how to check the password expire date for indual users

 
rajesh73
Super Advisor

how to check the password expire date for indual users

how to check the password expire  date for indual users

 

 

7 REPLIES 7
Dennis Handly
Acclaimed Contributor

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.

 

rajesh73
Super Advisor

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
rajesh73
Super Advisor

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
rajesh73
Super Advisor

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

Dennis Handly
Acclaimed Contributor

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.

rajesh73
Super Advisor

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

their is any other way to check the user password expire date
Matti_Kurkela
Honored Contributor

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