LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   apache - CBQ...superuser permission ...how to set..! HELP (https://www.linuxquestions.org/questions/linux-newbie-8/apache-cbq-superuser-permission-how-to-set-help-421205/)

ujjwal_wadhawan 03-03-2006 05:20 AM

apache - CBQ...superuser permission ...how to set..! HELP
 
Hi
i am doing a project on bandwidth management.I am using CBQ with some database. The project has a script that has to run in CGI....the script has to execute the command to restart the CBQ service...

Everything works fine except that i cannot execute the shell command from CGI or PHP exec() function,,,

code attached below for reference..

//file getinfo.sh
sh /etc/sysconfig/cbq/restartcbq.sh



//file restartcbq.sh
echo -e "SETTING UP CBQ CLASS <br>"
sleep 1

echo -e "service cbq.init restart nocache "
echo -e "<pre> $(service cbq.init restart nocache)</pre>"

echo -e "service cbq.init stats ##########Statistics ##########"
echo -e "<pre> $(service cbq.init stats) </pre>"

echo -e "<br> DONE................................Please Proceed<br>"


// OUTPUT in Webpage

DTU-ISP Suite--SHELL OUTPUT

SETTING UP CBQ CLASS

service cbq.init restart nocache


**CBQ: failed to add class 21 with parent on eth0!



service cbq.init stats ##########Statistics ##########

### eth0: queueing disciplines

qdisc sfq 21: quantum 1514b perturb 10sec
Sent 6293 bytes 20 pkts (dropped 0, overlimits 0)

qdisc cbq 1: rate 10Mbit (bounded,isolated) prio no
<snip>


the same command can be executed from shell with no error what so ever. I have tried adding the following line to /etc/sudoers in the end but its of no use.

<snip>
apache ALL = (ALL) NOPASSWD: /etc/rc.d/init.d/cbq.init,/sbin/tc,/sbin/ip
<snip>

i have also tried giving 777 in chmod to all files in /etc/sysconfig /var/www/html/ /var/www/cgi-bin/ and /etc/rc.d/init.d/

please tell me if i am wrong somewhere...or some superuser thing is missing... i have been googling around...but no success.!

please help..!!!!

thnx in anticipation
Ujjwal

ujjwal_wadhawan 03-20-2006 07:04 AM

gt the solution
 
well...i was not using SUDO correctly....

apache ALL = (root) NOPASSWD: /etc/rc.d/init.d/cbq.init, /etc/sysconfig/cbq/restartcbq.sh



it worked...!!!


All times are GMT -5. The time now is 11:30 PM.