Add User to Group in Linux

By | 2011/11/30

In Linux, the command gpasswd can be used to add or remove users from a group. I’ll show you how!


To add a user to a group, use tack a:

$ sudo gpasswd -a user group

The output looks like this:

$ sudo gpasswd -a joe admin
Adding user joe to group admin


To remove a user from a group, use tack d:

$ sudo gpasswd -d user group

The output looks like this:

$ sudo gpasswd -d joe admin
Removing user joe from group admin

Cool!