RHShadow
From My Admin Page
The Redhat Shadow file has the following format :
1:2:3:4:5:6:7:8:9 1 Login name 2 Encrypted password 3 Days since Jan 1, 1970 that password was last changed 4 Days before password may be changed 5 Days after which password must be changed 6 Days before password is to expire that user is warned 7 Days after password expires that account is disabled 8 Days since Jan 1, 1970 that account is disabled 9 A reserved field
Since Redhat doesn have the nice "passwd -sa" command like Solaris does, here's a script (run as root) to parse out the shadow file including showing the date of the last password change :
#!/bin/sh printf "%15s %5s %9s %5s %10s %5s\n" "User" "Pass" "last_chg" "min_days" "days_aft" "warn" printf "%15s %5s %9s %5s %10s %5s\n" "----" "----" "--------" "--------" "--------" "----" for i in `cat /etc/shadow`;do USER=`echo $i | awk -F : '{print $1}'` PASS=`echo $i | awk -F : '{print $2}'` CHGD=`echo $i | awk -F : '{print $3}'` DCHG=`echo $i | awk -F : '{print $4}'` DPWC=`echo $i | awk -F : '{print $5}'` DEXP=`echo $i | awk -F : '{print $6}'` MDY=`perl -e "use POSIX qw(strftime); print scalar strftime('%m/%d/%y', localtime($CHGD * 24 *3600));"` if [ "$PASS" = "*" ]; then PASS="NP" elif [ "$PASS" = "!!" ]; then PASS="LK" else PASS="PW" fi printf "%15s %5s %9s %5s %10s %5s\n" $USER $PASS $MDY $DCHG $DPWC $DEXP done
The output will look something like this :
User Pass last_chg min_days days_aft warn ---- ---- -------- -------- -------- ---- root PW 06/02/09 0 99999 7 bin NP 04/02/07 0 99999 7 daemon NP 04/02/07 0 99999 7 adm NP 04/02/07 0 99999 7 lp NP 04/02/07 0 99999 7 sync NP 04/02/07 0 99999 7 shutdown NP 04/02/07 0 99999 7 halt NP 04/02/07 0 99999 7 mail NP 04/02/07 0 99999 7 news NP 04/02/07 0 99999 7 uucp NP 04/02/07 0 99999 7