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
Removing a user from a group on Linux
Removing a user from a group on Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

Remove user from group via command line


SUBSCRIBE NEWSLETTER & RSS
Subscribe to RSS and NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


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.

  1. 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 command.
    $ 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 admin.
    $ groups admin
    admin : admin httpd mysql
    
  2. Next, let's remove user account admin from group httpd by executing the following command.
    $ sudo gpasswd -d admin httpd
    Removing user admin from group httpd
    
  3. Run the groups command 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.

  1. First, we'll need to install the gnome-system-tools package.
    $ sudo apt install gnome-system-tools
    
  2. Once it's done installing, launch the Users and Groups application.
  3. Search for and open the Users and Groups application
    Search for and open the Users and Groups application
  4. Next, click on the "Manage groups" button.
  5. Open the group management menu
    Open the group management menu
  6. Find the group in question, highlight it, and open "properties".


  7. Open the properties settings of the group you want to remove a user from
    Open the properties settings of the group you want to remove a user from
  8. Uncheck the user that you wish to remove from the group.
  9. Uncheck the user you wish to remove
    Uncheck the user you wish to remove
  10. Click OK when you're done, then you can close the Users and Groups menu.

Closing Thoughts

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.

FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.


Comments and Discussions