This article describes the steps to remove users from groups in Ubuntu Linux.
A group is a container that can 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.
Removing users from a group in Ubuntu Linux
As stated above, groups help administrators efficiently organize or administer user accounts’ access to resources. With grouping, you can provide access to a resource, and all group members will access it.
You can use the steps below to remove the account if a user is no longer needed in a group.
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, you use the commands below to change the primary group of the user geekrewind to developers.
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.
That should do it!
This post showed you how to remove users from groups in Ubuntu Linux. Please use the comment form below if you find any errors above or have something to add.