How to remove a user from sudo group?

QuestionsQuestions8 SkillsProUser Account ManagementSep, 28 2025
0364

To remove a user from the sudo group, you can use the deluser command or the usermod command, depending on your system. Here’s how to do it using both methods:

Method 1: Using deluser

On Debian-based systems (like Ubuntu), you can use the deluser command:

sudo deluser username sudo

Replace username with the actual name of the user you want to remove from the sudo group. For example, to remove joker:

sudo deluser joker sudo

Method 2: Using usermod

You can also use the usermod command to remove a user from the sudo group:

sudo usermod -G group1,group2 username

In this case, you need to specify all the groups the user should remain in, excluding sudo. For example, if joker is only in the sudo group and you want to remove them:

sudo usermod -G group1 joker

If joker is in multiple groups, list them all except sudo.

Verifying the Change

To verify that the user has been removed from the sudo group, you can check their group memberships:

groups username

For example:

groups joker

This will show the groups that joker is currently a member of.

If you have any further questions or need additional assistance, feel free to ask!

0 Comments

no data
Be the first to share your comment!