How to Remove User from Group in Ubuntu Linux

This article describes the steps you can take to remove users from groups in Ubuntu Linux.

In our previous post, we showed you how to add users to groups in Ubuntu Linux. This post shows you the other way around – removing users from groups in Ubuntu Linux.

A group is a container that can be used to organize or administer user accounts. Accounts in the same group will access and manage resources belonging to that group.

Every account on a Ubuntu Linux system belongs to one or more groups. There are two types of groups: Primary and secondary groups.

Below is a post on how to add users to groups in Ubuntu Linux.

How to add a user to a group in Ubuntu Linux

Removing users from a group in Ubuntu Linux

As stated above, groups help administrators organize or administer user accounts’ access to resources efficiently. With grouping, you can provide access to a resource and all members of the group will access it.

If a user is no longer needed in a group, you can use the steps below to remove the account.

The format to remove a user from a group is as follows:

sudo deluser username groupname

The deluser command is a script that uses the usermod command to add or remove users from groups.

For example, you remove the user named geekrewind from the developers‘ group, you run the commands below.

sudo deluser geekrewind developers

A user account must be a member of one primary group – typically a group with a similar name to the user. You can change the primary group of a user account.

For example, to change the primary group of the user geekrewind to developers, you use the commands below.

sudo usermod -g developers geekrewind

Doing that will remove the geekrewind user from its primary group to a new developers group as its primary group.

You can then remove the account from its previous primary group.

To verify a user group, run the command format below.

groups username

That should do it!


This post showed you how to remove users from groups in Ubuntu Linux. If you find any error above or have something to add, please use the comment form below.