On my Ubuntu system I followed the instructions for enabling sudo without a password.
It is working well, or should I say too well.
I have a couple of users, say userA and userB, who have been added to the sudo group.
sudo usermod -aG sudo userA
sudo usermod -aG sudo userB
I did sudo visudo
and I added the following line at the bottom (i.e. the very last line):
userA ALL=(ALL) NOPASSWD: ALL
However, I am finding that sudo without password is enabled for both userA and userB.
Question: How can I enable sudo without password for userA, but not userB?
/etc/sudoers
and any file you changed in/etc/sudoers.d
. Presumably you addedNOPASSWD:
to another line. Note that if multiple rules apply, the last one counts. – Gilles 'SO- stop being evil' Dec 10 '21 at 19:52%sudo
(i.e. the rule for members of group sudo) also haveNOPASSWD
? or do you have a line withDefaults exempt_group=sudo
? You added both users to the sudo group, and (fromman sudoers
) "Users in this group are exempt from password and PATH requirements." – cas Dec 11 '21 at 05:02