FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 10-28-2008, 10:46 AM
Tom Brown
 
Default Checking if a user is 'Disabled'

Hi

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?


thanks

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-28-2008, 11:01 AM
"Fajar Priyanto"
 
Default Checking if a user is 'Disabled'

On Tue, Oct 28, 2008 at 7:46 PM, Tom Brown <tom@ng23.net> wrote:
> Hi
>
> 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?

Can use:
passwd -S username

It will give either:
username PS 2008-10-28 0 9999 7 -1 (Password set, MD5 Crypt)
or when locked:
username LK 2008-10-28 0 9999 7 -1 (Password locked)

I'm sure there's other way.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-28-2008, 11:09 AM
Steve Huff
 
Default Checking if a user is 'Disabled'

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( "$!
" ); while ( <
$SHADOW> ) { chomp; print "$1
" 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




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

Thread Tools




All times are GMT. The time now is 10:43 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org