(RHEL5) Not able to delete/add user : unable to lock group/password file
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
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.
...which will return LOTS of messages, most of which won't apply to the users current problem. And the audit.log file will only be there if auditing is enabled. Neither of these suggestions will give any real information as to the OP's problem.
Quote:
Find lock file
Code:
find /etc -name *.lock
find /etc -name *.swp
...which you've added to this post. Again, the find command you have for the lock files won't actually FIND anything, since they may be HIDDEN, and that was pointed out before you edited this post. And again, the .swp file will ALSO be hidden (so that find command won't work either), and again, does nothing to address the problem. If the passwd file is being edited with vi, that won't cause the problem they're seeing. And just doing a "ps -ef | grep vi" will tell them if anyone is using VI, and on what file.
...which you've also added to this post. And again, these commands won't help at all. It is the presence of the .lock file that is causing this. Those commands may return false positives (if run when someone is logging in).
Quote:
After su to root, try uid
Code:
id
..which will do what, exactly? If they su to root, then they'll be root.
Quote:
Can you try to achieve with GUI?
Code:
system-config-users
...which won't do any good, since it calls the same system functions that the CLI utility does, and will die with the same error.
Dear TBOne,
Both of us are trying to suggest sakshi.garg23 problem. Definitely, you are far senior and much more experience than me. I agree that my troubleshooting way may mislead to sakshi.garg23 sometime. But I didn't do it purposely. You keep referring my signature about RHCE. Yes I earn it humbly for this certificate. It signature doesn't mean I know everything about redhat linux. I still need to learn a lot and keep learning.
I will also learn from your suggestion and advice. That is why I join this community. My primary reason to join this community is to share my experience with community and discuss other people difficulty.
Let's try to solve sakshi.garg23 problem together.
Dear TBOne,
Both of us are trying to suggest sakshi.garg23 problem. Definitely, you are far senior and much more experience than me. I agree that my troubleshooting way may mislead to sakshi.garg23 sometime. But I didn't do it purposely.
You are suggesting things that either:
Won't work at all
Or have NO bearing on the problem at all
All you are doing is confusing someone who needs help by posting bad and misleading advice. Things like the "mount" command, .swp files, and the 'find' commands that won't ever return anything(???) No point to any of it.
Quote:
You keep referring my signature about RHCE. Yes I earn it humbly for this certificate. It signature doesn't mean I know everything about redhat linux. I still need to learn a lot and keep learning.
If you claim to have certifications, you should have the KNOWLEDGE to back them up. The things you're suggesting indicate you don't. This is another great reason I give so little weight to 'certifications'.
Quote:
I will also learn from your suggestion and advice. That is why I join this community. My primary reason to join this community is to share my experience with community and discuss other people difficulty. Let's try to solve sakshi.garg23 problem together.
If you'd like to try to help with this problem, then stop posting meaningless and bad advice. What you learn and how is up to you. But posting bad and misleading advice that doesn't address the problems posted is POINTLESS, and only serves to confuse someone who is looking for help.
Ok, but again, that may not return anything...please re-read the previous posts. The file may start with a period ("."), which makes it a hidden file. So, do an "ls -a /etc/.*.lock" instead.
I got a file after doing ls -a /etc/.*.lock, removed it, listed it ( was gone ), then tried to delete the user, but again got the error message. The file reappeared.
[root@hostname ~]# ls -a /etc/.*.lock
/etc/.pwd.lock
[root@hostname ~]# rm -f /etc/.pwd.lock
[root@hostname ~]# ls -a /etc/.*.lock
ls: /etc/.*.lock: No such file or directory
[root@hostname ~]# userdel -r nishant
userdel: unable to lock group file
[root@hostname ~]# ps -ef |grep passwd
root 16867 16817 0 14:48 pts/2 00:00:00 grep passwd
[root@hostname ~]# ls -a /etc/.*.lock
/etc/.pwd.lock
[root@hostname ~]#
I got a file after doing ls -a /etc/.*.lock, removed it, listed it ( was gone ), then tried to delete the user, but again got the error message. The file reappeared.
[root@hostname ~]# ls -a /etc/.*.lock
/etc/.pwd.lock
[root@hostname ~]# rm -f /etc/.pwd.lock
[root@hostname ~]# ls -a /etc/.*.lock
ls: /etc/.*.lock: No such file or directory
[root@hostname ~]# userdel -r nishant
userdel: unable to lock group file
[root@hostname ~]# ps -ef |grep passwd
root 16867 16817 0 14:48 pts/2 00:00:00 grep passwd
[root@hostname ~]# ls -a /etc/.*.lock
/etc/.pwd.lock
[root@hostname ~]#
Well, at least the lock file has been found, but SOMETHING has to be creating it. Have there been any updates/patches to the system lately? Can you do an lsof on that file, to see what process(es) have it open?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.