Skip to content

Instantly share code, notes, and snippets.

@chanslor
Created October 19, 2017 15:46
Show Gist options
  • Save chanslor/10805f953c33543658fd9d2100fcccba to your computer and use it in GitHub Desktop.
Save chanslor/10805f953c33543658fd9d2100fcccba to your computer and use it in GitHub Desktop.
AIX shadow password last changed
#!/bin/ksh
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"; }
#Test with root
lastpwchg root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment