sudo prompts for password even though suders entry specifies NOPASSWD

I'm trying to give a specific user the ability to run two commands w/ sudo, without prompting for a password. This is what I did:

# temporarily grant privs to nitsadmin
Cmnd_Alias REBOOT = /usr/sbin/reboot
Cmnd_Alias STOP_START_CRUSHFTP = /var/opt/Crushftp/crushftp_init.sh

nitsadmin ALL=(ALL) NOPASSWD: STOP_START_CRUSHFTP, REBOOT

The reboot command works exactly as expected, but the crushftp_init.sh command insists on prompting for a password.

Help?

In repy to first comment, this is what I see:

nitsadmin@dropbox:~$ sudo /var/opt/CrushFTP10/crushftp_init.sh stop
[sudo] password for nitsadmin: 

So I'm pretty sure it's sudo that is prompting for a password.


Solution 1:

You may need to change:

Cmnd_Alias STOP_START_CRUSHFTP = /var/opt/Crushftp/crushftp_init.sh

to:

Cmnd_Alias STOP_START_CRUSHFTP = /var/opt/Crushftp/crushftp_init.sh*

The alias in the sudoers file needs to match exactly how the command will be run. So /var/opt/Crushftp/crushftp_init.sh does not match /var/opt/Crushftp/crushftp_init.sh install

EDIT: This will allow any variation of /var/opt/Crushftp/crushftp_init.sh to be run with sudo without a password. You can change your alias to Cmnd_Alias STOP_START_CRUSHFTP = /var/opt/Crushftp/crushftp_init.sh stop if you want to limit to only stop etc.