Skip to content
Follow
Ubuntu Linux

How to Remove Users from Groups in Ubuntu

Richard
Written by
Richard
Jan 3, 2023 Updated Sep 15, 2026 2 min read
How to Use Sticky Notes in Windows 11
How to Use Sticky Notes in Windows 11

Removing a user from an Ubuntu group revokes their access to shared system folders, devices, and special permissions. A group acts as a shared account list that controls what people can and cannot open or change on your computer.

Advertisement

You can manage these permissions using the Ubuntu terminal, which is the text-based command window built into releases like Ubuntu 22.04 LTS. Taking someone out of a group keeps your PC secure by making sure people only touch the files and settings they actually need.

⚡ Quick Answer

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`.

Advertisement

Removing users from a group in Ubuntu Linux

Removing users from groups in Ubuntu Linux takes just one terminal command. To drop a user from a specific group, open your terminal and type sudo deluser username groupname, replacing the placeholders with your actual user account and group names. This instantly revokes access to shared files or admin rights tied to that group.

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:

🐧Bash / Shell
sudo deluser username groupname

The deluser command is a script that relies on usermod (a utility for modifying user accounts) to manage group memberships.

Advertisement

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.

🐧Bash / Shell
sudo deluser geekrewind developers

Every user account belongs to a primary group, usually named after the user. Change this assignment with the commands below to assign geekrewind to the developers group.

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

🐧Bash / Shell
sudo usermod -g developers geekrewind

This action moves the geekrewind user from its current primary group to the developers group.

Advertisement

Removing the account from its previous primary group happens next.

💡TipTo check which groups a user belongs to, use the command below:
💻Code
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

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

📚 Related Tutorials

How to Add Users to Groups in Ubuntu Linux
Ubuntu Linux How to Add Users to Groups in Ubuntu Linux
Should You Enable Advanced Crash Dump Logging In Windows 11 Advanced System Settings
Windows Should You Enable Advanced Crash Dump Logging In Windows 11 Advanced System Settings
How to Install ClamAV Antivirus on Ubuntu Linux
Ubuntu Linux How to Install ClamAV Antivirus on Ubuntu Linux
How to Allow Remote Access to MariaDB in Ubuntu Linux
Ubuntu Linux How to Allow Remote Access to MariaDB in Ubuntu Linux

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *