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

# Remove User From Group in Linux
- URL: https://itsfoss.com/remove-user-from-group-linux/
- Published: 2023-06-08T15:05:39.000Z
- Updated: 2023-06-08T15:05:39.000Z
- Description: Learn how to remove a user from a certain group in the Linux command line.
- Author: Sagar Sharma
- Tags: Terminal, #hide

From its core, Linux is built to have multiple users, and dividing them into certain user groups is one of the best ways to control their access to certain parts of the system.

For example, you can add users to sudo group, so they can access sudo command.

But what if you want to remove a user from added group? Say, a user doesn't need to be sudoer anymore?

Well, in this tutorial, I'm going to show you multiple ways of removing users from group in Linux.

## How to remove a user from group in Linux

In this guide, I am going to show you 3 ways to remove a user from the user group in Linux:

1. Using the gpasswd command
2. Using the deluser command
3. By editing the /etc/group file

So let's start with the first one.

### 1\. Using the gpasswd command 

The gpasswd command in Linux is used to manage group passwords and its users. 

Which means, it can also be used to remove users from group.

But first, let's check the user group. To do so, use the groups command in the following manner:

```
groups <username>
```

![find usergroup in Linux](https://itsfoss.com/content/images/2023/06/find-usergroup-in-Linux.png)

To remove a user from the group, you'd have to use the gpasswd command in the following manner:

```
sudo gpasswd --delete <username> <groupname>
```

So let's say I want to remove my user `sagar` from the `Tux` user group, then, I'd have to use the following:

```
sudo gpasswd --delete sagar Tux
```

![remove user from group in Linux using gpasswd command](https://itsfoss.com/content/images/2023/06/remove-user-from-group-in-Linux-using-gpasswd-command.png)

To verify the process, you can check the groups associated to the user:

![check groups associated to the user](https://itsfoss.com/content/images/2023/06/check-groups-associated-to-the-user-1.png)

And as you can see, my user is no longer associated to the `Tux` group!

### 2\. Using the deluser command (For Ubuntu users only)

On Ubuntu, you get a special command `deluser` which is specifically built to provide a more user-friendly way of removing users.

To use the deluser to remove user from the group, it needs to be executed in the following manner:

```
sudo deluser <username> <group>
```

So let's say I want to remove user `sagar` from the `IF` group, then I'd have to use the following command:

```
sudo deluser sagar IF
```

![use deluser command to remove user from group in Linux](https://itsfoss.com/content/images/2023/06/use-deluser-command-to-remove-user-from-group-in-Linux.png)

Pretty simple! Isn't it?

### 3\. By editing the /etc/group file

In previous methods, you were given commands which would edit the `/etc/group` file for you, but here, you'd be doing that manually!

 First, open the /etc/group file using the following:

```
sudo nano /etc/group
```

Press `Ctrl +w` and type the group name:

![search the name of the group](https://itsfoss.com/content/images/2023/06/search-the-name-of-the-group.png)

Once you find the group, you'd find that your username is appended to the group name. 

So just remove the username as shown:

![remove user from group by editing /etc/group file in Linux](https://itsfoss.com/content/images/2023/06/remove-user-from-group-by-editing-etc-group-file-in-Linux.png)

Finally, [save changes and exit from the nano](https://linuxhandbook.com/nano-save-exit/?ref=itsfoss.com) text editor.

Now, if you check, your user will be no longer associated to the group:

![check user groups for user](https://itsfoss.com/content/images/2023/06/check-groups-associated-to-the-user-2.png)

Here you have it!

## It is time to embrace the terminal

The command line is the most efficient way to perform operations on your Linux system.

But most of the users still hate the terminal because of the way it looks, and typing commands looks too complex.

And at It's FOSS, we firmly believe that Linux users should [embrace the terminal](https://itsfoss.com/love-thy-terminal/) and this is why we came up with a series of tutorials to show you how to perform basic tasks:

[Linux Command Tutorials for Absolute BeginnersNever used Linux commands before? No worries. This tutorial series is for absolute beginners to the Linux terminal.![](https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png)It's FOSS![](https://itsfoss.com/content/images/2023/03/terminal-basics-series-tag.png)](https://itsfoss.com/tag/terminal-basics/)

I hope you will find this guide helpful!