Another way to modify a group's members is with
chgrpmemcommand allows you to list, add, and remove users from a group as well as modify the administrators of the group.
For example, the group xangroup has xander and atc as members and xander as an administrator of the group. Remove atc from the group, as shown in Listing.
Listing Remove a user from a group
# chgrpmem xangroup xangroup: members = xander,atc adms = xander # chgrpmem -m - atc xangroup # chgrpmem xangroup xangroup: members = xander adms = xander
Suppose there was a mistake and user atc was not supposed to be removed. Instead, user atc was supposed to become the administrator of the group, while xander's administrative rights were to be removed. Listing shows the code to make the correction.
Listing 24. Add a deleted user and change the group administrator
# chgrpmem -m + atc xangroup # chgrpmem -a + atc xangroup # chgrpmem -a - xander xangroup # chgrpmem xangroup xangroup: members = xander,atc adms = atc