gpasswd - Unix, Linux Command
NAMEgpasswd - administer the /etc/group file
gpasswd -a user group
gpasswd -d user group
gpasswd -R group
gpasswd -r group
gpasswd [-A user,...] [-M user,...] group
gpasswd is used to administer the /etc/group file (and /etc/gshadow file if compiled with SHADOWGRP defined). Every group can have administrators, members and a password. System administrator can use -A option to define group administrator(s) and -M option to define members and has all rights of group administrators and members.
Notes about group passwords
Group passwords are an inherent security problem since more than one person is permitted to know the password. However, groups are a useful tool for permitting co-operation between different users.
Group administrator can add and delete users using -a and -d options respectively. Administrators can use -r option to remove group password. When no password is set only group members can use newgrp to join the group. Option -R disables access via a password to the group through newgrp command (however members will still be able to switch to this group).
gpasswd called by a group administrator with group name only prompts for the group password. If password is set the members can still newgrp(1) without a password, non-members must supply the password.
|Group account information.|
|Secure group account information.|
1. Add user (tracy) to the group (hrd)
$ gpasswd -a tracy hrd
2. Add multiper users to the group (developer)
$ gpasswd -a pavan,john developer
3. Remove user (rakesh) from group (sqa)
$ gpasswd -d rakesh sqa
4. Remove multiple users from group (managers)
$ gpasswd -d shane,ron,ram managers
5. Set user (joy) and group administrator for (managers)
$ gpasswd -A joy managers
6. Set password for group
$ gpasswd managers Changing the password for group managers New Password: Re-enter new password: