Sunday, October 16, 2011

When root password was last updated in Aix server

 This is cumbersome to know when root password was lasted updated in Aix system especially at times of audit. Calculating the days/time as per the info in /etc/security/password which is really a madness. Here is the solution of how to check when root password was last updated.

1) Check lastupdate in /etc/security/passwd    or pwdadm -q root
root:
        lastupdate = 1316984479

 
2) Then run this command
perl -le 'print scalar localtime 1316984479'


Mon Sep 26 02:31:19 2011

 
That's it!

1 comment:

  1. Or maybe you can do it like this:

    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"; }

    Then:

    lastpwchg root

    ReplyDelete