[PLUG] Allow User to Run Shell Script As root
Dale Snell
ddsnell at frontier.com
Mon Mar 19 15:14:31 UTC 2012
On Sun, 18 Mar 2012 11:42:42 -0700 (PDT)
Rich Shepard <rshepard at appl-ecosys.com> wrote:
> I'm far from competent with /etc/sudoers syntax.
>
> I have a simple, one-line script
> in /home/<user>/shell-scripts/homenet.sh that I want to have run with
> root privileges (because it copies /etc/resolv.conf.home
> to /etc/resolv.conf).
>
> With this line in /etc/sudoers
>
> %users = ALL=(root) NOPASSWD /home/<user>/shell-scripts/homenet.sh
>
> the command, 'shell-scripts/homenet.sh', tells me permission is
> denied to create the file. With no entry in /etc/sudoers but running
> the comand following 'sudo ' I'm told that the user is not allowed to
> execute the script as root on that host.
>
> Please educate me in the proper syntax for /etc/sudoers so a user
> can run a shell script as root.
>
Rich,
I'm not much of an expert myself, but I believe you need to have a
colon at the end of the NOPASSWD tag.
%users = ALL=(root) NOPASSWD: /home/<user>/shell-scripts/homenet.sh
I *think* that will do what you want. I think.
Hope this helps,
--Dale
--
The most costly of all follies is to believe passionately in the
palpably not true. It is the chief occupation of mankind.
-- H.L. Mencken
More information about the PLUG
mailing list