4

Hi I executed this command sudo adduser username sudo and am wondering how do I take that username out from being able to execute sudo. I checked the sudoers file but the username that I added thru the command line is not in there. Does anyone know what command should I execute to take out the username? Thank you.

2
  • for completeness power to issue sudo can be given to user just by entry into sudoers file without giving user group sudo so in general, as you mention, to remove sudo powers do two things: remove mention of user in sudoers file as well as remove user from group sudo ... this question should be reopened as its not simply a group membership question Aug 24, 2021 at 12:04
  • I can remove the user from the group, its just odd that the command usermod, used to modify user accounts, can add users to groups but can remove them? my question is how to remove users from groups with usermod. I see some things in the man page i dont understand, like the -W option. it says -W is to remove a list of "gids". are "gids" groups?
    – j0h
    Sep 12, 2022 at 17:11

1 Answer 1

5

adduser username sudo adds username to the sudo group. Members of the sudo group are allowed sudo access in the default sudoers file:

%sudo   ALL=(ALL:ALL) ALL

You shouldn't remove this line just to deny this user sudo access. Instead, undo the group addition:

sudo deluser username sudo

Not the answer you're looking for? Browse other questions tagged .