Mega Code Archive

 
Categories / Perl / System Functions
 

Find all users without passwords

#!/usr/local/bin/perl -w     my $count = 1;     while (($account, $passwd, $uid, $gid, $quota, $comment, $gcos, $home, $shell) = getpwent()){         if ($passwd eq "" || $passwd eq "*")         {             write;             $count++;         }     }     format STDOUT_TOP=     Count Account         UID    GID    Home         .     format STDOUT=     @>>>> @<<<<<<<<<<<<<< @<<<<< @<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<     $count,$account,$uid,$gid,$home         .