Create Delete And Modify Local Groups And Group Memberships
General Information
Local group management.
Important Files
Groups config file
- /etc/group
Group Commands
See what groups a user is a part of (two methods)
id student groups student
See what members are apart of the group “class1”
getent group class1 OR groupmems -l -g class1
Create new group
groupadd class1
- Other options
- -g ⇒ specify a group id
- -r ⇒ create a system group
Set primary group (-g) for the user “student” to “class1”
usermod -g class1 student
Append (-a) supplementary group(-G) for the user “student”
usermod -aG class2 student
Change group name to “class5” from “class1”
groupmod -n class5 class1
Delete group
groupdel class5
- Note: Cannot delete a user's primary group