LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 04-01-2009, 01:01 PM   #1
landysaccount
Member
 
Registered: Sep 2008
Location: Dominican Republic
Distribution: Debian
Posts: 188

Rep: Reputation: 18
permission denied error when restart dhcp3-server


Hello..

I have a script that needs to restart my dhcp3-server but is unable to. The server is ran by root by default. I try to issue "/etc/init.d/dhcp3-server restart" from a php script and I get a permission denied error.

How can I work around to be able to stop and restart the dhcp3 server or how can I run it with a different user?
 
Old 04-01-2009, 03:23 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Add the apache user to sudoers, and grant him the right to execute exactly that
command above.
 
Old 04-01-2009, 06:44 PM   #3
landysaccount
Member
 
Registered: Sep 2008
Location: Dominican Republic
Distribution: Debian
Posts: 188

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by Tinkster View Post
Add the apache user to sudoers, and grant him the right to execute exactly that
command above.
I did exactly that:

visudo

www-data ALL: NOPASSWD /etc/init.d/dhcp3-server restart

The error I get is that it can't kill the process id since is running by root. I even changed the ownership to www-data to /var/run/dhcp.pid file and that still can't kill the process and run the new configuration.

Any other idea?
 
Old 04-01-2009, 09:00 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
That's not a valid sudoers line, it has no = anywhere.

How did you manage to save that w/o it swearing at you?



Cheers,
Tink
 
Old 04-02-2009, 12:01 PM   #5
landysaccount
Member
 
Registered: Sep 2008
Location: Dominican Republic
Distribution: Debian
Posts: 188

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by Tinkster View Post
That's not a valid sudoers line, it has no = anywhere.

How did you manage to save that w/o it swearing at you?



Cheers,
Tink
I actually missed putting the = sign on the post. I have it correct in the system:

www-data ALL= NOPASSD: /etc/init.d/dhcp3-server restart
 
Old 04-02-2009, 01:43 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
and the W in NOPASSWD?
 
Old 04-03-2009, 07:16 AM   #7
landysaccount
Member
 
Registered: Sep 2008
Location: Dominican Republic
Distribution: Debian
Posts: 188

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by Tinkster View Post
and the W in NOPASSWD?
As I mentioned, I have it correctly spelled in the sudoers file...
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
TFTP server returns "Error Code 0: Permission Denied" gi99 Linux - Networking 2 04-19-2011 07:17 AM
permission denied error aahiqmir Linux From Scratch 1 03-30-2009 02:51 AM
-bash: /etc/init.d/network restart: permission denied mariusmusicus Linux - Networking 3 01-31-2008 01:00 PM
Sound Server (Permission Denied error) rapont Slackware 8 10-29-2007 03:49 AM
permission denied error endezeichen Linux - General 5 12-20-2003 07:59 PM


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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration