[CentOS] Checking if a user is 'Disabled'

Tom Brown tom at ng23.net
Tue Oct 28 12:53:31 UTC 2008


>
>
> this should get you a list of all the users which have been disabled 
> by means of `usermod -L`:
>
> perl -e 'open($SHADOW, "<", "/etc/shadow") or die( "$!\n" ); while ( 
> <$SHADOW> ) { chomp; print "$1\n" if (/^([^:]*):!{1}[^!:]*:.*$/) } 
> close( $SHADOW );'
>
> you'll need to run it as root.  no doubt that regex could be cleaned 
> up a bit :)

thanks both - that gives me something to work with



More information about the CentOS mailing list