Learning Objectives
By the end of this chapter, you should be able to:
Groups
Where is the groups config file location?
/etc/group
Groups
Describe the components of a record in the /etc/group file.
Inside /etc/group file
groupname:password:GID:user1,user2,…
Group Management
What is the command to add a new group?
groupadd
$ sudo groupadd -r -g 215 staff
🚩 Be very careful with the usermod -G command; the group list that follows is the complete list of groups, not just the changes. Any supplemental groups left out will be gone! Non-destructive use should utilize the -a option, which will preserve pre-existing group memberships when adding new ones.
Group Management
What is the command to remove a group?
groupdel
$ sudo groupdel newgroup
Group Management
What is the command to modify a group and add new users?
groupmod
$ sudo groupmod -g 101 blah
Group Management
What is the command to manage a user’s group memberships?
usermod
$ sudo usermod -G student,group1,group2 student
Group Management
The group manipluation utilities modify which 2 group config files?
/etc/group
/etc/gshadow (if it exists)
User Private Groups
What is a User Private Group?
The idea behind UPGs is that each user will have his or her own group.
However, UPGs are not guaranteed to be private; additional members may be added to someone’s private group in /etc/group.
By default, users whose accounts are created with useradd have: primary GID = UID and the group name is also identical to the user name.
Group Membership
A Linux user has ___ primary group; this is listed in ___ and will also be listed in ___.
Group Membership
Group membership can be identified by running either of the following commands?
With no arguments, either command reports on the current user. Note that the default groups can differ by distribution:
On CentOs:
[student@CentOS7 ~]$ groups
student
On Ubuntu:
student@ubuntu:~$ groups
student adm cdrom sudo dip plugdev lpadmin sambashare libvirt