Manage Linux Group Using gpasswd Command

March 14, 2013 | By in HOWTOS, LINUX COMMANDS
| Reply More

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


Share This :

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.