LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (http://www.linuxquestions.org/questions/linux-security-4/)
-   -   sudo access for a user to a script (http://www.linuxquestions.org/questions/linux-security-4/sudo-access-for-a-user-to-a-script-857082/)

kaplan71 01-18-2011 01:21 PM

sudo access for a user to a script
 
Hi there --

I am trying to get a non-root account on one of our servers to run a script with sudo capability. To that end, I went into the /etc/sudoers file, and added the following syntax:

Code:

## Enable the nagios user to run the check_iptables.sh script as root
nagios  ALL=NOPASSWD: /usr/local/nrpe/libexec/check_iptables.sh, /sbin/iptables

I restarted the nagios service, and tested the results. The results were the user account still could not run the script due to the user, nagios, not having permission to run the iptables binary.

Is there another step(s) that I need to take in order to get the sudo access available to the user account?

stress_junkie 01-18-2011 01:28 PM

Are you sure that is the privilege violation? On my system, Ubuntu 10.04, any user can run iptables. That is the default file permission. However there may be a privilege violation if the ordinary user tried to change the tables or perform some other function within iptables.

Maybe something else in nagios or iptables is not being granted privileged access.

Naturally you are trying this by preceding the command with sudo aren't you?
Code:

sudo iptables --list


All times are GMT -5. The time now is 01:29 PM.