Manage Linux Group Using gpasswd Command

The gpasswd command (As defined in the man page) is used to administer /etc/group, and /etc/gshadow. Every group can have administrators, members and a password.

Command Options

-a, --add user Add the user to the named group.
-d, --delete user Remove the user from the named group.
-A, --administrators user,... Set the list of administrative users.
-M, --members user,... Set the list of group members.

gpasswd examples

Let us assume that we have a group named sales and three users user1,user2,user3.

Add User

To add user1 to sales group

gpasswd -a user1 sales

Add multiple user

To add multiple users to sales group

gpasswd -M user1,user2,user3 sales

Remove user

To remove user2 from sales group

gpasswd -d user2 sales

How to set a user as group administrator

gpasswd -A user group


gpasswd -A user1,user2 sales

Example :

gpasswd -A nixsavy linuxgroup

Set password for group

$ gpasswd linuxgroup

Changing the password for group linuxgroup

New Password:

Re-enter new password:

Browse Linux commands

Bobbin Zachariah 9:00 am

About Bobbin Zachariah

Founder of LinOxide, passionate lover of Linux and technology writer. Started his career in Linux / Opensource from 2000. Love traveling, blogging and listening music. Reach Bobbin Zachariah about me page and google plus page.

Author's All Posts
Like to become part of Linoxide Team and contribute tips? Contact us here.


Your email address will not be published. Required fields are marked *

All comments are subject to moderation.

1 Comment

  1. The example for -M above implies adding user1,user2,user3 in addition to users already there.
    The man pages for gpasswd clearly state that option -M is to "Set the list of group members."
    This will destroy any existing set of members, so therefore is not an implicit "add" unless the group was empty to begin with.