Thursday, September 16, 2010

Providing Sudo access to commands with arguments

Situation:
You need to grant sudo access to a command that takes some parameters.

For example the following command takes “username” as the parameter.

#nxserver --useradd  <username>

If we just give “nxserver --useradd” in the /etc/sudoers file, it wouldn’t work.


Solution:
Use wild characters in /etc/sudoers file as shown in the following:

%itops ALL=(ALL)  nxserver --useradd  [A-Za-z]*      (or)

%itops ALL=(ALL)   nxserver --useradd ?*          # Where %itops is the groupname


No comments:

Post a Comment