Re: Checking if a user is 'Disabled'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]




On Oct 28, 2008, at 7:46 AM, Tom Brown wrote:

I need to create some local users but then 'disable' that user. I know i can enable and disable the user by using usermod -L and -U but does anyone know if there is a way for me to see the current status of the user? ie locked or unlocked?


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 :)

-steve

---
If this were played upon a stage now, I could condemn it as an improbable fiction. - Fabian, Twelfth Night, III,v



<<attachment: smime.p7s>>

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux