adduser not working - unable to lock passwd
I am running RH 7.2 (I think. It's 7.x for sure. It's been up for so long) as a samba and web server for internal network. Recently, I tried to add a user using linuxconf but did not work. I tried "useradd", but it could not be executed because it can not "lock the password file".
(exact output is - useradd: unable to lock password file) I ended up adding the users by manually creating the home directories and vi-ing the /etc/passwd and /etc/shadow files, copying all the .bash* files etc. from another existing home directory, chown-ing (-R) the home directories, then running passwd <newuser>. I ran fuser to see if there is any process (like another session of linuxconf I fogot to close, etc.) using passwd or shadow, but there seems to be no other process accessing the file. Can anyone help me with figuring out what is going on? Thanks. |
Re: adduser not working - unable to lock passwd
Quote:
So try that with root and it should work. |
I have executed su.
Note that I was able to vi /etc/passwd and /etc/shadow. If I were not root, I wouldn't be able to do that. I am not daring enough to give anything more than 644 and 400, respectively, to these files. The error message was not that I do not have write priviledge to the password file, but "unable to lock." |
Quote:
You can't use 400 coz if some user other than root try to access it he will be denied. You can try 744 normally as it would not compromise your security. |
Sorry for resurrecting a thread so old, but it's the first result Google returned after I encountered this behavior today.
I got the same adduser error and saw the expected lockfile, /etc/.pwd.lock. lsof showed nothing using it, and when I removed it, it would appear again after running the adduser command. The cause was - in this case, at least - pretty prosaic; the filesystem was full. After space was freed up, the command ran as expected. I hope that's helpful for someone else ten years from now. |
All times are GMT -5. The time now is 03:04 PM. |