LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-22-2003, 11:16 AM   #1
Shin Takeshita
LQ Newbie
 
Registered: Dec 2002
Location: Novi, MI
Distribution: Red Hat
Posts: 25

Rep: Reputation: 15
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.
 
Old 05-23-2003, 09:22 AM   #2
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
Re: adduser not working - unable to lock passwd

Quote:
Originally posted by Shin Takeshita
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.
You can't add a user unless you are suid
So try that with root and it should work.

Last edited by rch; 05-23-2003 at 09:24 AM.
 
Old 05-23-2003, 11:30 AM   #3
Shin Takeshita
LQ Newbie
 
Registered: Dec 2002
Location: Novi, MI
Distribution: Red Hat
Posts: 25

Original Poster
Rep: Reputation: 15
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."
 
Old 05-27-2003, 09:41 AM   #4
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
Quote:
Originally posted by Shin Takeshita
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."
I had similiar problem like yours when I was trying to change my password over telnet.The password file /etc/passwd needs to be locked to access it(means that it should not be used by anybody else(or any other process)).Maybe you are familiar with the locks in /var/.So I ask you whether you were changing the password through the network or anything else was using it?
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.
 
  


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
sudo :adduser: unable to lock password file khamdy Linux - General 9 10-13-2010 05:26 AM
samba: Unable to open/create TDB passwd cccc Debian 1 07-05-2006 07:55 PM
passwd: Unable to set failure delay vaibhavk Linux - Security 1 02-04-2002 05:45 PM
RH 7.1 Gnome unable to lock the screen Ismark Linux - Security 1 01-12-2002 04:42 AM
How to Lock Files (/etc/passwd /var/spool/[user] Larry James Programming 3 12-04-2000 11:06 AM


All times are GMT -5. The time now is 08:31 AM.

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