How to Remove Users from Groups in Ubuntu
Removing a user from a group in Ubuntu revokes their access to shared system folders, devices, and special permissions. A group is simply a shared club for user accounts that controls what you can and cannot open or change.
You can manage these permissions using the Ubuntu terminal, which is the text-based command window built into versions like Ubuntu 22.04 LTS. Taking someone out of a group keeps your PC secure by making sure people only have access to what they actually need.
You remove users from groups in Ubuntu using the command line. Type `sudo deluser username groupname` to remove a specific user from a group. You can verify group membership by running `groups username`.
Removing users from a group in Ubuntu Linux
Removing users from groups in Ubuntu Linux occurs with a single command.
Accounts lose access to shared files and permissions when dropped from an Ubuntu group. Removing a user from the ‘sudo’ group, for instance, revokes their administrator privileges.
The command format to remove a user from a group looks like this:
sudo deluser username groupname
The deluser command itself is a script that leverages the usermod command to manage user group memberships.
Executing a specific command in the terminal removes a user from a group in Ubuntu. Running `sudo gpasswd -d geekrewind developers`, for example, targets the user named `geekrewind` and removes them from the `developers` group. This command handles the removal directly without requiring deep knowledge of other system settings.
sudo deluser geekrewind developers
Every user account belongs to a primary group, usually named after the user. Changing this assignment takes a few keystrokes.
For example, use the commands below to change the primary group for the user geekrewind to developers.
sudo usermod -g developers geekrewind
This action moves the geekrewind user from its current primary group to the developers group.
Removing the account from its previous primary group happens next.
groups username
This process concludes here.
Conclusion:
- Groups in Ubuntu Linux help administrators efficiently organize or administer user accounts' access to resources
- The format to remove a user from a group is "sudo deluser username groupname"
- The deluser command uses the usermod command to add or remove users from groups
- It's important to note that a user account must be a member of one primary group
- You can change the primary group of a user account using the usermod command
- Verifying a user group can be done by running the "groups username" command
How do I remove a user from the group?
Once the target user gets identified, click on their entry. Then, select 'Remove from group' to confirm.
How to remove multiple users together from a group in Linux?
Removing multiple users from a group in Linux happens efficiently, even though specific commands only allow processing one user at a time.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.
No comments yet — be the first to share your thoughts!