> ## Content Index
> Fetch the complete content index at: https://linuxhandbook.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Remove User From Group in Linux [Quick Tip]
- URL: https://linuxhandbook.com/remove-user-from-group/
- Published: 2020-03-02T16:54:54.000Z
- Updated: 2020-07-18T06:44:35.000Z
- Description: Learn how to remove a user from a specific group in Linux command line.
- Author: Abhishek Prakash
- Tags: Tips

[Group management](https://linuxhandbook.com/group-management/) and user account management is one of the regular tasks performed by a Linux sysadmin. Adding to and removing from groups is part of these tasks.

Suppose you are in a situation where you need to remove a user from a group. Take a practical example where you don’t want to give a user access to [run docker containers](https://linuxhandbook.com/run-docker-container/). One way would be to remove this user from the [docker](https://www.docker.com/?ref=linuxhandbook.com) group.

All the members in the docker group can [use docker commands without sudo](https://linuxhandbook.com/docker-permission-denied/). Removing the user from the group would mean that the [user would need sudo access](https://linuxhandbook.com/create-sudo-user/) to run the commands.

## How to remove user from group

Now how do you remove a user from a group? There are two steps involved here:

- Find the groups of the user
- Add the user to all of its existing group except the ones you want to remove it from

### Step 1: Find the groups of the user

First, [list all the groups the user](https://linuxhandbook.com/check-group-of-user/) is member of [using id command](https://linuxhandbook.com/id-command/) like this:

```
id -nG user_name
```

This will list all the groups of the user.

```
abhishek@nuc:~$ id -nG prakash
prakash adm cdrom sudo dip plugdev lpadmin sambashare docker
```

### Step 2: Removing user from the group

You can [use the usermod command](https://linuxhandbook.com/usermod-command/) here with option G. With option -G, you specify which groups this user will belong to. If the user is currently a member of a group which is not listed, the user will be removed from the group.

```
sudo usermod -G group1,group2,group3 user_name
```

**Do note that the group names must be separated by comma but there should be no whitespace between them.**

```
sudo usermod -G prakash,adm,cdrom,sudo,dip,plugdev,lpadmin,sambashare prakash
```

Now if I display the groups, you can see that it is no longer a member of docker group.

```
abhishek@nuc:~$ id -nG prakash
prakash adm cdrom sudo dip plugdev lpadmin sambashare
```

[5 Commands for Group Management in LinuxGroup is an essential part of Linux system management and security. Check out various commands that you can use for managing groups in Linux.![](https://linuxhandbook.com/assets/icon-192x192.png?v=486a2d151a)Linux HandbookAbhishek Prakash![](https://linuxhandbook.com/content/images/2020/06/Group-Management-Linux-1.jpg)](https://linuxhandbook.com/group-management/)

I hope you like this quick little Linux tip on removing user from groups. Questions and suggestions are always welcome.