LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-11-2007, 02:20 AM   #1
tataiermail
Member
 
Registered: Apr 2006
Location: calcutta, IND
Distribution: RHEL AS 4, openSUSE 10.2
Posts: 48

Rep: Reputation: 15
viewing a locked account


hi all,

i have locked an account with usermod -L usrname.
i know i can unlock with -U switch.
but, where can i check that the account is locked or how can i check which r the accounts that r locked in the system?

thanks in advance,

suman
 
Old 07-11-2007, 03:00 AM   #2
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
If you look in /etc/passwd, locked accounts will have an exclamation mark (!) in the encrypted password section.

Last edited by reddazz; 07-11-2007 at 03:01 AM.
 
Old 07-11-2007, 03:07 AM   #3
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Exclamation mark is generally used, but as far as I understand, an account can be "locked" by adding a character into the encrypted password field in /etc/shadow (most systems don't have a password in /etc/passwd because it needs to be readable by the users, the encrypted password is stored in /etc/shadow instead) that "doesn't fit" there. It means that only certain characters can be used in the encrypted password, and if a character is found from the field that is not supposed to be there, the password is unreadable by the program and thus the account is locked.
 
Old 07-11-2007, 03:17 AM   #4
tataiermail
Member
 
Registered: Apr 2006
Location: calcutta, IND
Distribution: RHEL AS 4, openSUSE 10.2
Posts: 48

Original Poster
Rep: Reputation: 15
hi,
thanks a lot to both of you guys.
thanks reddazz, for giving me the quick reply.
but as b0uncer said now a days the password stays in /etc/shadow.
thanks b0uncer, for your detailed explanation.
yes, i have found that my testuser is havin a ! mark in beginning of the password field in shadow.
so, this way i can check whether the login problem is due to disabled account.

thanks a lot guys,

suman
 
Old 07-11-2007, 03:20 AM   #5
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
If you use shadow passwords, locking an account prepends an exclamation point to the encrypted password field.
Using usermod -U username removes the asterisk.

So "sudo sed -n '/^[[:alpha:]]*:\!/p' /etc/shadow" will list the locked accounts, which will include locked system accounts.

Last edited by jschiwal; 07-11-2007 at 03:23 AM. Reason: typo fix
 
Old 07-11-2007, 03:21 AM   #6
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
Actually, its my error there. I meant to say /etc/shadow and not /etc/passwd. Cheers for the correction.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prevent user account from logging in but allow su to account DejaCpp Linux - General 4 07-26-2006 11:44 AM
is it legitimate and allowed and can be done to make another user account set uid and gid to null 0 to make another root account with different name and possibly not damage the debian system creating and using that new account BenJoBoy Linux - Newbie 12 01-29-2006 10:02 AM
Locked-down user account lukeprog Ubuntu 6 01-28-2006 11:21 AM
How to get a list of users with their password status (expired, account locked...)? ricky_ds Linux - General 6 02-28-2005 09:53 AM
locked pop3-account jonas_the_joker Linux - General 1 10-17-2003 07:08 AM


All times are GMT -5. The time now is 07:35 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration