LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   permission denied error when restart dhcp3-server (https://www.linuxquestions.org/questions/linux-newbie-8/permission-denied-error-when-restart-dhcp3-server-716106/)

landysaccount 04-01-2009 12:01 PM

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?

Tinkster 04-01-2009 02:23 PM

Add the apache user to sudoers, and grant him the right to execute exactly that
command above.

landysaccount 04-01-2009 05:44 PM

Quote:

Originally Posted by Tinkster (Post 3495283)
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?

Tinkster 04-01-2009 08:00 PM

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

landysaccount 04-02-2009 11:01 AM

Quote:

Originally Posted by Tinkster (Post 3495533)
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

Tinkster 04-02-2009 12:43 PM

and the W in NOPASSWD?

landysaccount 04-03-2009 06:16 AM

Quote:

Originally Posted by Tinkster (Post 3496291)
and the W in NOPASSWD?

As I mentioned, I have it correctly spelled in the sudoers file...


All times are GMT -5. The time now is 03:44 PM.