Linux remove user from group

 

To remove user from a group we need to select a user and group.

Lets say here my user is guest and I want to remove guest user from fuse group.

First list the group id’s for the user guest. To get group id’s there are 2 ways.

$ id -nG guest

Output: guest adm dialout fax cdrom floppy tape dip video plugdev fuse

or

$ groups guest

Output: guest : guest adm dialout fax cdrom floppy tape dip video plugdev fuse

As I decided to remove gust user from fuse group you need to run following command.

$ usermod -G guest,adm,dialout,fax,cdrom,floppy,tape,dip,video,plugdev guest

Syntax: usermod -G {group1,guoup2,…} <userName>

Now list the groups for user guest with id or groups command.

$ id -nG guest

Output: guest adm dialout fax cdrom floppy tape dip video plugdev

In above output there is no group fuse for user guest.

-Sany

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s