• Share
  • ?
  • Profiles ▼
  • Communities ▼
  • Apps ▼

Blogs

  • My Blogs
  • Public Blogs
  • My Updates
  • Administration
  • Log in to participate

▼ Tags

 

▼ Similar Entries

AIX Live Update Acro...

Blog: Liveupdate
Sharath Kumar 50RQXPUDPW
Updated
3 people like thisLikes 3
No CommentsComments 0

AIX Live Update with...

Blog: Chris's AIX B...
cggibbo 270000TMUJ
Updated
1 people likes thisLikes 1
No CommentsComments 0

IBM APM 8.1 - Synthe...

Blog: Application P...
ericmtn 1000009W88
Updated
1 people likes thisLikes 1
No CommentsComments 0

How do I use the vio...

Blog: Chris's AIX B...
cggibbo 270000TMUJ
Updated
2 people like thisLikes 2
No CommentsComments 0

z/VSE requirement fo...

Blog: Ingolf's z/VS...
Ingolf24 120000DRN3
Updated
0 people like thisLikes 0
CommentsComments 1

▼ Archive

  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • November 2013
  • October 2013
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • April 2012

▼ Blog Authors

Brian Smith's AIX / UNIX / Linux / Open Source blog

View All Entries
Clicking the button causes a full page refresh. The user could go to the "Entry list" region to view the new content.) Entry list

One Liner Script to Show Last Time a Users Password was Changed on AIX

brian_s 270002K5X3 | | Tags:  ksh script aix password ‎ | 1 Comment ‎ | 40,310 Views

AIX stores the last time a user changed their password as a "epoch" time stamp, or in other words as the number of seconds since 1970. 

For example, if you want to see when the last time root changed their password you can type:

 

# lsuser -a lastupdate root
root lastupdate=1391663150
 

This shows that root changed their password at 1,391,663,150 seconds after 1970.  In other words, this really isn't very helpful unless you take this epoch number and convert it to a real date. 

Here is a one liner function that will give you a "lastpwchg" command that will show a normal date/time for a users last password change.   Just type "lastpwchg" followed by the username you would like to check:

 

function lastpwchg { [ "`whoami`" = "root" ] || { echo "Must be root"; return; };  printf "$1:  "; lastupdate=`lsuser -a lastupdate $1 2>/dev/null | awk -F= "{print \\$2}"`; [ -n "$lastupdate" ] && perl -e "print \"Last password change: \" . scalar (localtime($lastupdate)) . \"\n\" " || echo "User does not exist or has no lastupdate attribute"; }

 


You can add this one liner to your .profile so it is always available when you login.

The results look like this when you run it to check a user:

 

# lastpwchg root
root:  Last password change: Wed Feb  5 23:05:50 2014
#
# lastpwchg padmin
padmin:  Last password change: Wed Nov 14 21:29:58 2013
 

If you found this useful, you might also want to check out this post:  Don't let your AIX passwords expire

Modified on by brian_s 270002K5X3
  • Add a Comment Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry
Notify Other People
notification

Send Email Notification

+

Quarantine this entry

deleteEntry
duplicateEntry

Mark as Duplicate

  • Previous Entry
  • Main
  • Next Entry
Feed for Blog Entries | Feed for Blog Comments | Feed for Comments for this Entry