I have granted a group permission to run certain commands with no password via sudo. When one of the users makes a typo or runs the wrong command the system prompts them for their password and then they get an error. This is confusing for the user so I'd like to just display an error instead of prompting them for a password. Is this possible?
Here is an example of my sudoers file:
%mygroup ALL=(ALL) NOPASSWD:/usr/local/bin/myscript.sh *
Example when they run the wrong script:
# sudo /usr/local/bin/otherscript.sh [sudo] password for user: Sorry, user user is not allowed to execute '/usr/local/bin/otherscript.sh' as root on <hostname>.
Sorry, user user is not allowed to execute '/usr/local/bin/otherscript.sh' as root on <hostname>. Please check the command and try again.
Note the lack of password prompt.
My google-fu has failed me and only returns results on not asking for a password when the user is permitted to run the command.