LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Restart FreeRadius from PHP Script (Run command as another user) (http://www.linuxquestions.org/questions/linux-software-2/restart-freeradius-from-php-script-run-command-as-another-user-947997/)

buee 06-01-2012 11:39 AM

Restart FreeRadius from PHP Script (Run command as another user)
 
Ok, so I've been trying to find a way to refresh the configuration files of FreeRadius from a PHP page that I've been working on. I can do this one of two ways:
  1. /etc/init.d/freeradius force-reload
  2. /usr/sbin/freeradius -C

However, the trouble I'm running in to is privileges. I know I have to do this from the sudoers file, but I can't seem to get it to work. The user for apache is www-data as default, the user for FreeRadius is freerad. My assumption is that I need to give www-data permissions to run one of those commands (preferably /usr/sbin/freeradius -C) as either root or freerad without prompting for a password. But HOW?!

I've edited the sudoers file a million different times. Anything that's bold is something I haven't changed:

Code:

www-data        localhost = (ALL) NOPASSWD: /usr/sbin/freeradius -C
I have a feeling it's something stupid like a space where it shouldn't be, but I've played around with different formatting and still can't get the command to work. What's worse is the /usr/sbin/freeradius -C doesn't return an output that I can tell nor does an entry appear to show up in /var/log/auth.log. My brain is shot, someone help me please.


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