LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX
User Name
Password
Other *NIX This forum is for the discussion of any UNIX platform that does not have its own forum. Examples would include HP-UX, IRIX, Darwin, Tru64 and OS X.

Notices


Reply
  Search this Thread
Old 06-04-2008, 12:01 AM   #1
binary_0011
Member
 
Registered: Apr 2006
Location: Singapore
Distribution: RHEL4,FC4,FC5
Posts: 89

Rep: Reputation: 15
how to check the password expiry date of a user?


i want to check when is the password expiry date of a particular user, how can I do that in HP UX 11?

I don't need a script, i just want to check the status of some users occasionally.

Thanks.
 
Old 06-04-2008, 01:37 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If your system uses the /etc/shadow file, then that is where the information is contained, rather than /etc/passwd.

To read an record in many system files, you can use the "getent" command. However the shadow file is readable only by root.
Code:
NAME
       shadow - encrypted password file

DESCRIPTION
       shadow  contains  the  encrypted password information for user's accounts and optional the password
       aging information. Included is

            Login name

            Encrypted password

            Days since Jan 1, 1970 that password was last changed

            Days before password may be changed

            Days after which password must be changed

            Days before password is to expire that user is warned

            Days after password expires that account is disabled
You can use awk to calculate the expiration date, field 3 + field 5. This is the date since 1970 so you need to use the "date" command to make this human readable. ( see man shadow for details ) Also check the man/info page for your version of awk to see if it has a function that can convert a SYSTIME entry to a human readable form. If so, calculating "24*60*60*($3+$5)" in awk will give the SYSTIME version of the expiration date.

There may also be a "chage" command. As root you can enter "chage -l <username>". If you are a regular user, a password may be necessary. If you have the chage command, then this would be the handiest way to get a readily human readable form of this information.


If neither of these work, you need to look into how user account information is stored. Do you use NIS or LDAP? Do you use PAM and pam_userdb.so? The /etc/nsswitch file may contain some useful pointers. For example, look at the "users:" line and the "shadow:" line.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
User login expiry date? geekgrl Linux - Security 7 07-04-2011 06:08 AM
Terminal Command to find out expiry date on user accounts Caighil Linux - Newbie 3 02-29-2008 04:47 PM
how to check the date for the user ID created? dwarf007 Linux - Security 1 08-22-2007 04:00 AM
How to check User ID creation Date? dwarf007 Linux - Security 1 08-22-2007 02:18 AM
Password expiry klmn1 Linux - Networking 0 12-29-2002 10:29 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX

All times are GMT -5. The time now is 06:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration