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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-11-2007, 02:20 AM
|
#1
|
Member
Registered: Apr 2006
Location: calcutta, IND
Distribution: RHEL AS 4, openSUSE 10.2
Posts: 48
Rep:
|
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 
|
|
|
07-11-2007, 03:00 AM
|
#2
|
LQ Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298
Rep:
|
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.
|
|
|
07-11-2007, 03:07 AM
|
#3
|
LQ Guru
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131
Rep: 
|
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.
|
|
|
07-11-2007, 03:17 AM
|
#4
|
Member
Registered: Apr 2006
Location: calcutta, IND
Distribution: RHEL AS 4, openSUSE 10.2
Posts: 48
Original Poster
Rep:
|
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
|
|
|
07-11-2007, 03:20 AM
|
#5
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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
|
|
|
07-11-2007, 03:21 AM
|
#6
|
LQ Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298
Rep:
|
Actually, its my error there. I meant to say /etc/shadow and not /etc/passwd. Cheers for the correction.
|
|
|
All times are GMT -5. The time now is 10:35 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|