- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- pw_age field using getpwnam
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2008 12:48 PM
тАО10-27-2008 12:48 PM
I am using HPUX 11.11
I have been looking at the pw_age field of the login record (struct passwd) using getpwname and experienting with aging. The pw_age field (which can be seen
in the /etc/passwd) can changes anywhere from "B/PT", "//bT", "0/aT", "0/dT",...etc depending on how many days I set the password to expire.
Is there a way to determine what these values mean? I have a request from a user to determine from these values when their password is expired. Is there a better way to find out if a password has expired?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2008 01:04 PM
тАО10-27-2008 01:04 PM
Re: pw_age field using getpwnam
See:
http://www.docs.hp.com/en/B3921-60631/passwd.4.html
...under "Password Field".
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2008 01:32 PM
тАО10-27-2008 01:32 PM
Re: pw_age field using getpwnam
I have been experimenting with the following commands
Command: passwd -f -n 1 -x 91 fms
Aging Value: B/PT
Command: passwd -f -n 1 -x 1 fms
Aging Value: //bT
Command: passwd -f -n 1 -x 2 fms
Aging Value: //bT
Command: passwd -f -n 1 -x 10 fms
Aging Value: 0/aT
Command: passwd -f -n 1 -x 15 fms
Aging Value: 1/ZT
In all these instances the users are forced to change their password right-a-way.
But According to the documentation (if m = M = 0, derived from . or ..) then it's supposed to mean expired.
So how can I tell if the user wants to also right-a-way expire the password as well?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2008 03:22 PM
тАО10-27-2008 03:22 PM
Re: pw_age field using getpwnam
> In all these instances the users are forced to change their password right-a-way.
Using the '-f' option forces immediate expiration. See the 'passwd(1)' manpages for the details:
http://www.docs.hp.com/en/B3921-60631/passwd.1.html
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2008 08:59 AM
тАО10-28-2008 08:59 AM
Re: pw_age field using getpwnam
For example "B/PT", the P is supposed to represent "27". So does that mean 27 weeks since the last password change?
What does the "T" mean if it means anything at all?
Unfortunately the documentation is a little brief on how to interpet these last 2 characters.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2008 01:56 PM
тАО10-28-2008 01:56 PM
Re: pw_age field using getpwnam
So you have to multiply the value for the first char by 64 and then add the value for the second.
Here is an example in perl, how to print the 'weeks' value for a character:
perl -le 'foreach (q(.),q(/),0..9,A..Z,a..z) {$x{$_}=$i++}; print $x{(shift)}'
And here is that example expanded to tage 2 characters as (seperate) arguments, figure out the weeks and from there the time:
perl -le 'foreach (q(.),q(/),0..9,A..Z,a..z) {$x{$_}=$i++}; print scalar localtime(7*86400*(64*$x{(shift)}+$x{(shift)}))' T P
.... Wed Jul 16 20:00:00 2008
or if I have those reversed
.... Wed Sep 17 20:00:00 2003
enjoy,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2008 03:24 PM
тАО10-28-2008 03:24 PM
Re: pw_age field using getpwnam
Thanks for your reply. For this one:
perl -le 'foreach (q(.),q(/),0..9,A..Z,a..z) {$x{$_}=$i++}; print scalar localtime(7*86400*(64*$x{(shift)}+$x{(shift)}))' T P
Where does the 86400 and 7 come from and how did they, when multipled by the aging characters give the date?
Something to do with the based date of 1970 they mentioned in the documentation?
- Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2008 03:41 PM
тАО10-28-2008 03:41 PM
Solution86400 = 24 * 60 * 60 = the number of seconds in an average day.
7 = then number of days in a week :-)
>> how did they, when multipled by the aging characters give the date?
Something to do with the based date of 1970 they mentioned in the documentation?
Yes.
When multiplied with the number of weeks since the beginning of (unix) time, they become to be the number of seconds since 'the beginning of time'... which 'time()' as a scalar happily formats.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2008 07:30 PM
тАО10-28-2008 07:30 PM
Re: pw_age field using getpwnam
$ passwd_expires 1/ZT
Max weeks to expire: 3
Min weeks to reset: 1
Weeks since 1970: 2021
Password was reset on: Wed Sep 24 17:00:00 2008
Password expires on: Wed Oct 15 17:00:00 2008
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-29-2008 07:55 AM
тАО10-29-2008 07:55 AM