Differences
This shows you the differences between two versions of the page.
linux_wiki:create_delete_and_modify_local_groups_and_group_memberships [2016/03/05 16:47] billdozor |
linux_wiki:create_delete_and_modify_local_groups_and_group_memberships [2019/05/25 23:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== 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) | ||
- | <code bash> | ||
- | id student | ||
- | groups student | ||
- | </ | ||
- | |||
- | \\ | ||
- | See what members are apart of the group " | ||
- | <code bash> | ||
- | getent group class1 | ||
- | OR | ||
- | groupmems -l -g class1 | ||
- | </ | ||
- | |||
- | \\ | ||
- | Create new group | ||
- | <code bash> | ||
- | groupadd class1 | ||
- | </ | ||
- | * Other options | ||
- | * -g => specify a group id | ||
- | * -r => create a system group | ||
- | |||
- | \\ | ||
- | Set primary group (-g) for the user " | ||
- | <code bash> | ||
- | usermod -g class1 student | ||
- | </ | ||
- | |||
- | \\ | ||
- | Append (-a) supplementary group(-G) for the user " | ||
- | <code bash> | ||
- | usermod -aG class2 student | ||
- | </ | ||
- | |||
- | \\ | ||
- | Change group name to " | ||
- | <code bash> | ||
- | groupmod -n class5 class1 | ||
- | </ | ||
- | |||
- | \\ | ||
- | Delete group | ||
- | <code bash> | ||
- | groupdel class5 | ||
- | </ | ||
- | * Note: Cannot delete a user's primary group | ||
- | |||
- | ---- | ||