How you can Add or Take away a Consumer from a Group in Linux


Get real time updates directly on you device, subscribe now.

Linux is by default a multi-user system (which means many customers can connect with it concurrently and work), thus consumer administration is among the elementary duties of a system administrator. Consumer administration consists of all the pieces from creating, updating, and deleting consumer accounts or consumer teams on a Linux system.

On this brief fast article, you’ll learn to add or take away a consumer from a gaggle in a Linux system.

Verify a Consumer Group in Linux

To test a consumer group, simply run the next teams command and supply the username (tecmint on this instance) as an argument.

# teams tecmint

tecmint : tecmint wheel

To test your individual teams, simply run the teams command with none argument.

# group


Check a User Group in LinuxVerify a Consumer Group in Linux

Add a Consumer to a Group in Linux

Earlier than making an attempt so as to add a consumer to a group, be sure that the consumer exists on the system. So as to add a consumer to a sure group, use the usermod command with the -a flag which tells the usermod so as to add a consumer to the supplementary group(s), and the -G possibility specifies the precise teams within the following format.

On this instance, tecmint is the username and postgres is the group title:

# usermod -aG postgres tecmint
# teams tecmint

Add User to Group in LinuxAdd Consumer to Group in Linux

Take away a Consumer from a Group in Linux

To take away a consumer from a gaggle, use the gpasswd command with the -d possibility as follows.

# gpasswd -d tecmint postgres
# teams tecmint

Remove User from Group in LinuxTake away Consumer from Group in Linux

Moreover, on Ubuntu and it’s spinoff, you’ll be able to take away a consumer from a particular group utilizing the deluser command as follows (the place tecmint is the username and postgres is the group title).

$ sudo deluser tecmint postgres

For extra info, see the person pages for every of the completely different instructions now we have used on this article.

Additionally, you will discover the next consumer administration guides very helpful:

If You Respect What We Do Right here On TecMint, You Ought to Think about:

TecMint is the quickest rising and most trusted neighborhood web site for any form of Linux Articles, Guides and Books on the net. Hundreds of thousands of individuals go to TecMint! to look or browse the 1000’s of printed articles accessible FREELY to all.

For those who like what you’re studying, please think about shopping for us a espresso ( or 2 ) as a token of appreciation.

Support Us

We’re grateful on your by no means ending assist.

Leave A Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More