Today I'm going to walk you through
how to create, modify and delete groups in Linux.
Groups allow us to grant access
in a more efficient manner.
Groups associate user accounts
that have similar security requirements,
and they also help simplify our task as administrators
by allowing multiple users
to be granted permissions to resources.
So, in this example,
we're going to imagine we have a organization
that require us to have four different departments.
We're going to use the graphics, sales, marketing,
and finance departments.
Okay, so let's go ahead and add the graphics department.
So first, we're going to do sudo, going to do groupadd Graphic.
It asks for my password here.
All right.
Now we can check the groups in the etc/group folder,
or the group file.
You can see graphics there at the bottom.
Now, if we're going to go over the fields really quick,
the group instance has four fields associated to each group.
The group name,
the next field is going to be the passwords,
then the group ID,
and the last will be a list of all the users
that are part of that group.
Now, currently the graphics is blank
'cause we haven't added any users,
but as we go throughout the example,
we're going to come back after we added some users
and we're going to see it populate there.
All right. Let's clear this out.
And we go ahead add the other departments.
Go ahead and scroll up, use the (indistinct) first.
We're going to do sales department,
then do marketing department
and then finally finance.
Boom.
Alright, again, we're going to go and check and make sure
those groups were added on the etc/group file.
All right, boom. We see 'em at the bottom there.
Next we're going to go over modifying the group.
Now, if you see I've named all the other departments,
sales department, marketing department, finance department.
But graphics just doesn't match.
So to keep the scheme the same
we're going to modify this group.
Sudo group, mod,
use the N option,
and we're going to change the name first
to the graphics department.
And then we're going to point to the actual group
that we're trying to change.
All right.
So we see we've changed the graphics department.
We see that at the bottom there.
Next, what we're going to do
is we're going to add users to the groups.
Now for this example,
and to add users, we're going use the user mod command.
We're going to use sudo, user mod,
and for the option, we're going to do append group.
And so we're going to use myself,
and we're going to add me to the graphics department.
All right, let's see if that went through there.
Now you see at the bottom, J Kelly,
is part of now the graphics department.
So we're going to use the other users again
to see which users we have from the password file.
And so we're going to add Anderson, Mason, and Riley.
We're going to add them to different groups,
just for little practice.
I don't want to type them all the way out.
So we're going to do C. Mason there.
Marketing.
We're going to do (indistinct).
A. Riley.
All right.
I was going to verify that we have everything taken care of.
All right, simple as that.
We see we added C. Mason to the sales department,
M. Anderson to the marketing department,
A. Riley to the finance department,
And again, I, Jamario Kelly, am in the graphics department.
And similar to modifying user accounts,
we can delete groups.
Simply to delete a group,
we're going to use the sales department.
And again, it's kind of like user mod or user delete
but instead it's going to be group delete.
We're going to use sales department.
Now, deleting the group does not delete the members
that are in the group.
And we can verify this by going back to the etc.
So let's see.
Etc/group.
We see the sales department is gone.
And I believe we had C. Mason in the group
for the sales department.
So let's check and see if C. Mason's still out there.
So we go to etc file, go to cat/etc. Password.
And we see C. Mason is still an active user.
So deleting the group did not delete the users
that was associated to the group.
So that's good to go there.
All right, that was quick and easy.
We went over how to create, modify and delete groups.
And I'll see you again in the next lesson.