There is plenty of information on how to make sudo not prompt for passwords (NOPASSWD).
Let's say I have user alice
, and this line in my sudoers:
alice ALL=(root) NOPASSWD: /bin/myadmintool
This works just fine. The user can run sudo /bin/myadmintool
and do stuff.
However, if the user were to do this:
sudo /bin/bash
This is what happens:
$ sudo /bin/bash
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
Password:
Sorry, user alice is not allowed to execute '/bin/bash' as root on myhostname.
What I would like to happen is for sudo to jump directly to:
Sorry, user alice is not allowed to execute '/bin/bash' as root on myhostname.
... without the password prompt.
How can I express this in the sudoers file, just for this user?