Managing user accounts on a Linux system is a fundamental part of administration. Even casual Linux users will run into situations where they need to list user accounts, remove users, and do other basic user management tasks.
In this guide, we’ll see how to remove a user from a group on Linux. This can be done either through GUI or command line, and we’ll go over the step by step instructions for both methods.
In this tutorial you will learn:
- How to remove a user account from a group through GUI and command line
|Requirements, Conventions or Software Version Used
|Any Linux distro
|Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Remove user from group via command line
Your Linux distribution will sometimes add users to certain groups by default. Other times, installing packages on the system may cause users to be added to a group or groups. And you can always add users to groups manually.
Regardless of how a user became part of a group, the instructions below will remove them from it.
- First, let’s identify the groups that the user is a part of. If you’re already logged in as the user, you can just use the
$ groups linuxconfig adm cdrom sudo dip plugdev lpadmin lxd sambashare
Alternatively, specify the name of the user whose groups you wish to view. In the command below, we view the groups for a user account called
$ groups admin admin : admin httpd mysql
- Next, let’s remove user account
httpdby executing the following command.
$ sudo gpasswd -d admin httpd Removing user admin from group httpd
- Run the
groupscommand once again to verify the change.
$ groups admin admin : admin mysql
Remove user from group via GUI
The following instructions show how to remove a user from a group on the GNOME desktop environment. The instructions will vary a little if you’re using a different desktop environment, and the screenshots will look different. However, the process is mostly the same.
- First, we’ll need to install the
$ sudo apt install gnome-system-tools
- Once it’s done installing, launch the Users and Groups application.
- Next, click on the “Manage groups” button.
- Find the group in question, highlight it, and open “properties”.
- Uncheck the user that you wish to remove from the group.
- Click OK when you’re done, then you can close the Users and Groups menu.
In this guide, we saw how to remove a user from a group on Linux through both command line and GNOME GUI. This is a basic, albeit important task for Linux administrators and normal users alike. It can increase security to only have users be a part of groups that they absolutely need access to.