LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 03-01-2004, 12:58 AM   #1
khamdy
LQ Newbie
 
Registered: Mar 2004
Distribution: RH 9
Posts: 8

Rep: Reputation: 0
sudo :adduser: unable to lock password file


Hey,
I know this has been asked a million times, but it hasn't provided a resolution for me. I'm new, and ignorant with terminology, but I'm eager to learn.

THE POINT
I wanna be able to allow people to create a webspace on my server. FTP/Web Account, and email. I'm using a php form, posting to a cgi script.

...

system ("/usr/bin/sudo -u bob /usr/sbin/adduser $userid -c '$f_name $l_name' -p $password");


I have "bob" in the sudoers file as "bob ALL=(ALL) ALL"

I keep getting adduser: unable to lock password file. Can someone please tell me what that is and why I'm getting it and how to resolve it. I deleted the .lock files too. I'm going nuts.

Thanks
Kareem
 
Old 03-01-2004, 03:24 AM   #2
gsibble
Member
 
Registered: Jul 2003
Distribution: Arch .5 and Solaris 9/10
Posts: 162

Rep: Reputation: 30
My guess (and it's more a guess here than anything else) is that bob needs to be authenticated before changing the file. (I don't see how you are typing in a password here) And because that authentication uses the password file, you cannot lock it to then change it.

That's my guess at least.

-G
 
Old 03-01-2004, 09:50 AM   #3
khamdy
LQ Newbie
 
Registered: Mar 2004
Distribution: RH 9
Posts: 8

Original Poster
Rep: Reputation: 0
ok so how would I go about doing that? https?

Thanks
Kareem
 
Old 03-01-2004, 02:22 PM   #4
gsibble
Member
 
Registered: Jul 2003
Distribution: Arch .5 and Solaris 9/10
Posts: 162

Rep: Reputation: 30
Try setting NOPASSWD: ALL
or NOPASSWD: adduser

That should work. Also: You really need to change the ALL=ALL to something a little more secure. Protect the root. Always remember that.

-G
 
Old 03-19-2004, 12:42 PM   #5
Glitch010101
LQ Newbie
 
Registered: Mar 2004
Location: New York City
Distribution: Fedora Core 3
Posts: 4

Rep: Reputation: 0
Thumbs up Solution to problem

I've just encountered this same problem after upgrading a RH 7.2 box to FC1

The problem was the password lock files (obviously) but also quite literally.

I did the following:
Code:
mv /etc/passwd.lock /etc/passwd.lock.bak
and then repeated it for:
group.lock
gshadow.lock
shadow.lock

after doing this, i could add and remove users again.
 
Old 03-27-2004, 12:38 AM   #6
khamdy
LQ Newbie
 
Registered: Mar 2004
Distribution: RH 9
Posts: 8

Original Poster
Rep: Reputation: 0
Still no luck...


# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#

# Host alias specification

# User alias specification

# Cmnd alias specification

# Defaults specification

# User privilege specification
root ALL = (ALL) ALL
apache ALL = (ALL) NOPASSWD: /usr/sbin/adduser


i tried adduser and /usr/sbin/adduser

either way it says the same.. "adduser: unable to lo
ck password file"


I searched and deleted any .lock files. I don't have any..

system ("/usr/bin/sudo -u apache /usr/sbin/adduser $userid -p $password");


i've been taking out flags to minimize errors.. no luck..

any ideas?


Kareem
 
Old 03-28-2004, 12:53 AM   #7
khamdy
LQ Newbie
 
Registered: Mar 2004
Distribution: RH 9
Posts: 8

Original Poster
Rep: Reputation: 0
Hey I got it to work..

yay

now if i can only get sendmail working correctly.. lol

thanks
kareem
 
Old 05-19-2004, 04:50 PM   #8
hardcode
LQ Newbie
 
Registered: May 2004
Distribution: rh9
Posts: 1

Rep: Reputation: 0
hey,
i´d like to know how you did it...
i´m having the same problem you had!
thank you in advance...
by the way, i´m using rh9...

Last edited by hardcode; 05-19-2004 at 04:57 PM.
 
Old 07-23-2004, 12:22 AM   #9
lawtoncooper
LQ Newbie
 
Registered: Jul 2004
Posts: 2

Rep: Reputation: 0
Hi khamdy

Could you be so kind and tell us what was involved in resolving this issue.

regards

Lawton
 
Old 10-13-2010, 05:26 AM   #10
obik
LQ Newbie
 
Registered: Oct 2010
Posts: 1

Rep: Reputation: 1
lock file

I had same problem, the problem is with lock files
check for /etc/.*lock
 
1 members found this post helpful.
  


Reply



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
adduser not working - unable to lock passwd Shin Takeshita Linux - General 4 10-24-2014 04:51 PM
"useradd: unable to lock password file" need help monzter Programming 1 08-16-2004 12:59 AM
Postfix->filter Script->sudo adduser lawtoncooper Linux - General 0 07-23-2004 01:12 AM
userdel: unable to lock password file asc3ndant Linux - General 1 06-20-2003 01:07 PM
unable to lock password file beefyd Linux - Security 3 09-08-2002 09:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration