This article is going to take you through on how to remove user from specific group in Linux. A group in Linux is a collection of users. The primary objective of groups is to specify a set of privileges for a certain resource that may be shared across the users inside the group, such as read, write, or execute access.
We are going to remove user from specific group in Linux using the following methods;
How to remove user from specific group in Linux via GUI on Debian/Ubuntu systems
- Lets start by installing
gnome-system-tools
using the command below.
sudo apt install gnome-system-tools
Sample output
Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: liboobs-1-5 policykit-1-gnome system-tools-backends Suggested packages: ntp The following NEW packages will be installed: gnome-system-tools liboobs-1-5 policykit-1-gnome system-tools-backends 0 upgraded, 4 newly installed, 0 to remove and 46 not upgraded. Need to get 3,853 kB of archives. After this operation, 10.8 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://ke.archive.ubuntu.com/ubuntu jammy/universe amd64 system-tools-backends amd64 2.10.2-3.1 [106 kB] Get:2 http://ke.archive.ubuntu.com/ubuntu jammy/universe amd64 liboobs-1-5 amd64 3.0.0-4 [60.2 kB] Get:3 http://ke.archive.ubuntu.com/ubuntu jammy/universe amd64 policykit-1-gnome amd64 0.105-7ubuntu3 [26.4 kB] Get:4 http://ke.archive.ubuntu.com/ubuntu jammy/universe amd64 gnome-system-tools amd64 3.0.0-9.1ubuntu1 [3,660 kB] Fetched 3,853 kB in 2s (2,240 kB/s) Selecting previously unselected package system-tools-backends. (Reading database ... 169283 files and directories currently installed.) Preparing to unpack .../system-tools-backends_2.10.2-3.1_amd64.deb ... Unpacking system-tools-backends (2.10.2-3.1) ... Selecting previously unselected package liboobs-1-5:amd64. Preparing to unpack .../liboobs-1-5_3.0.0-4_amd64.deb ... Unpacking liboobs-1-5:amd64 (3.0.0-4) ... Selecting previously unselected package policykit-1-gnome. Preparing to unpack .../policykit-1-gnome_0.105-7ubuntu3_amd64.deb ... Unpacking policykit-1-gnome (0.105-7ubuntu3) ... Selecting previously unselected package gnome-system-tools. Preparing to unpack .../gnome-system-tools_3.0.0-9.1ubuntu1_amd64.deb ... Unpacking gnome-system-tools (3.0.0-9.1ubuntu1) ... Setting up system-tools-backends (2.10.2-3.1) ... Setting up policykit-1-gnome (0.105-7ubuntu3) ... Setting up liboobs-1-5:amd64 (3.0.0-4) ... Setting up gnome-system-tools (3.0.0-9.1ubuntu1) ... Processing triggers for desktop-file-utils (0.26-1ubunt u3) ... Processing triggers for hicolor-icon-theme (0.17-2) ... Processing triggers for gnome-menus (3.36.0-1ubuntu3) . .. Processing triggers for libglib2.0-0:amd64 (2.72.0-1) . .. Processing triggers for libc-bin (2.35-0ubuntu3) ... Processing triggers for man-db (2.10.1-1) ... Processing triggers for dbus (1.12.20-2ubuntu3) ... Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
- After installation, users and groups can be launched from the application menu.
- Next click manage group button to continue as shown below.
- Click the group name that you want to remove the user from e.g. games then click properties to open group settings.
- Remove the user from the group by unchecking their box.
After unchecking click OK to save your changes.
How to remove user from specific group in Linux via Command Line
- Check user groups using the command
group
followed byuser name
as shown below.
groups demo
- To remove user from group e.g. mail run the command below.
sudo gpasswd -d demo mail
- Verify user is removed from the group by running the groups command again.
groups demo
- You can also remove user from group using the following command.
sudo deluser demo mail
Add User to Group
- To add user to group e.g. demo user to mail group run the command below.
usermod -aG mail demo
- You’ve made it to the end of the article, Cheers. You have learned how to remove user from specific group in Linux.
Other Tutorials
Backup Linux systems using BackupPC