Adding and removing members to a group
●Add members to a group
To add a member to an existing group, run the gpasswd command with the option "-a".
The argument is the name of the user or group to be added and executed.
This process can be executed by root or a user registered as a group administrator.
[root@Lion ~]# gpasswd -a koro newgr ←Add "koro" to the "newgr" group Adding user koro to group newgr [root@Lion ~]# cat /etc/group | grep koro ←Verify that you have been added to the group newgr:x:600:koro koro:x:601: |
●Removing a member from a group
To remove a member from an existing group, run the gpasswd command with the option "-d".
Specify the user name and group name to be deleted as arguments and execute.
This process can be performed by root or a user registered as a group administrator.
[root@Lion ~]# cat /etc/group | grep koro newgr:x:600:koro koro:x:601: [root@Lion ~]# gpasswd -d koro newgr ←Remove koro from the group "newgr". Removing user koro from group newgr [root@Lion ~]# cat /etc/group | grep koro ←Make sure you are out of the group. koro:x:601: |