Administer groups

The gpasswd command is used to administer groups in Linux. You can add or remove users from groups, set or change the group password, set users as group administrators, etc.

To add a user to a group, use the gpasswd command with the -a option:

gpasswd command a option

As you can see from the output above, the user john was added to the group named project.

To remove a user from a group, user the -d option:

gpasswd command d option

To set a user as a group administrator, use the -A option. Group administrators can add and remove other members from the group and change the group password:

gpasswd command administrators

To set a user as a group administrator and add the user to the list of group members, use the -M option with the gpasswd command.

 

Invoked without any arguments except a group name, the gpasswd command will change the group password:

gpasswd command

Subscribe to our Newsletter

Like us on Facebook

top
Geek University 2019