Reading the Shadow File


#
# Read /etc/shadow if it exists.
if (! -f $SHADOW) {
        print "No shadow password file.  Testing without it.\n";
        $shadow = 0;
}
else {
        $shadow = 1;
        open(SH,$SHADOW) || die "Unable to open shadow file $SHADOW\n";
        while ($line = <SH>) {
                chomp($line);
                local($junk); # make the -w not error the variable junk
                ($name, $password, $junk) = split(":", $line);
                $password{$name} = $password;
        }
}

root:$1$wCMjE7QH$iCGn3g25BXmcBAMvhisN70:10926:0:99999:7:::134537404
bin:*:10821:0:99999:7:::
stearmst:$1$.QSbvyrB$JzJ3wo5pA25iSCDWLL4pn/:10844:0:99999:7:::134537780
jhryshka:$1$7EKmFDAX$gdOJP519tGe.SdjaspYe6/:10844::99999::::135458876
lhanson:wyR2TjIYOIKMw:10854::99999::::134537732
jcattron:4QTFOCAZjh.K6:10926::99999::::134537748