Recently I have had the auditors in at my current 9-5. One of the things they wanted to see is when certain users changed their passwords, this was on Solaris and Linux machines.
Below I have shown a couple of simple ways to do this for both Solaris and Linux. If you have a couple of users then you can use the basic commands or at the bottom there is a Perl script which I found on the interwebs. This will show you all the users and the date of when they last changed the password.
As I have not used or written any Perl for a while, I have also rewritten the Perl Script into Python, which I am a lot more comfortable. So whatever your flavour you should be able to find the information out.
One advantage of the scripts are you can run them on both platforms, so in case you can't remember the specific commands.
# Output date format is YYYY-MM-DD
open( S, "/etc/shadow" );
while( <S> )
($user,$lastchg) = (split /:/)[0,2];
@t = localtime( $lastchg*86400 );
printf "User %-8s last changed password %0.4d-%0.2d-%0.2d (%5d)\n",
$user, $t+1900, $t+1, $t, $lastchg;
close( S );
# Author : Craig Richards
# Created : 08th October 2013
# Last Modified :
# Version : 1.0
# Modifications :
# Description : This will show the last time users changed their passwords
for f in open("/etc/shadow"):
if chdate == "":
print ('User ' + user + ' last changed their password on : ' + lastchange + ' (' + str(chdate) + ')')
I am always interested in your thoughts so if you have any comments or feedback then please feel free to add any comments, or you can mail me here