1
00:00:00,240 --> 00:00:01,200
In this video,

2
00:00:01,200 --> 00:00:03,480
we're going to discuss how to create, modify,

3
00:00:03,480 --> 00:00:05,280
and delete user groups.

4
00:00:05,280 --> 00:00:08,460
In order to gain access to users in a more efficient manner,

5
00:00:08,460 --> 00:00:11,190
you'll need to create groups for users to be a part of.

6
00:00:11,190 --> 00:00:13,560
This means that groups associate user accounts

7
00:00:13,560 --> 00:00:15,450
that have similar security requirements,

8
00:00:15,450 --> 00:00:17,850
and we can then assign rights and permissions to the groups

9
00:00:17,850 --> 00:00:20,550
instead of directly to the individual users.

10
00:00:20,550 --> 00:00:22,050
Just like user accounts,

11
00:00:22,050 --> 00:00:25,110
groups can also be modified and deleted when needed.

12
00:00:25,110 --> 00:00:27,090
Groups simplify administrative tasks,

13
00:00:27,090 --> 00:00:30,390
and they're represented on a system by a group ID number.

14
00:00:30,390 --> 00:00:33,510
Users can also be a member of more than one group.

15
00:00:33,510 --> 00:00:35,460
For example, on my network,

16
00:00:35,460 --> 00:00:37,410
I'm a member of the administrator's group.

17
00:00:37,410 --> 00:00:39,180
I'm also a member of the instructor's group

18
00:00:39,180 --> 00:00:40,380
and the accounting group,

19
00:00:40,380 --> 00:00:42,210
because I fill all these various work roles

20
00:00:42,210 --> 00:00:44,760
and responsibilities within my company.

21
00:00:44,760 --> 00:00:45,930
As an administrator,

22
00:00:45,930 --> 00:00:49,470
you're commonly going to reference the /etc/group file

23
00:00:49,470 --> 00:00:51,870
to find information about groups on your system,

24
00:00:51,870 --> 00:00:54,930
because it's the storage location for all of the groups.

25
00:00:54,930 --> 00:00:57,570
Each group is going to contain four fields of information

26
00:00:57,570 --> 00:00:59,100
separated by a colon.

27
00:00:59,100 --> 00:01:00,900
First, you have a Group Name.

28
00:01:00,900 --> 00:01:02,940
Second, you have a Password.

29
00:01:02,940 --> 00:01:04,800
Third, you have the Group ID.

30
00:01:04,800 --> 00:01:07,200
And fourth, you have the Group List.

31
00:01:07,200 --> 00:01:08,340
The group name refers

32
00:01:08,340 --> 00:01:10,410
to the user friendly name of the group.

33
00:01:10,410 --> 00:01:13,140
For example, you might find a group called instructors

34
00:01:13,140 --> 00:01:14,970
on my company system.

35
00:01:14,970 --> 00:01:17,070
The password field refers to the password

36
00:01:17,070 --> 00:01:19,350
that's being required to enter this group.

37
00:01:19,350 --> 00:01:21,600
The group ID refers to the reference number

38
00:01:21,600 --> 00:01:23,490
of the system for the group.

39
00:01:23,490 --> 00:01:25,080
And then we have the group list,

40
00:01:25,080 --> 00:01:26,790
and this refers to the group members

41
00:01:26,790 --> 00:01:28,590
that are part of this group.

42
00:01:28,590 --> 00:01:30,840
By default, the group list will be empty,

43
00:01:30,840 --> 00:01:34,440
because a new group has no members when you first create it.

44
00:01:34,440 --> 00:01:37,230
Now, the proper way to edit the /etc/group file

45
00:01:37,230 --> 00:01:41,250
is to use the groupadd, groupmod, or groupdel commands.

46
00:01:41,250 --> 00:01:43,680
The groupadd command is going to create the group.

47
00:01:43,680 --> 00:01:47,610
By default, the group has no members and no password.

48
00:01:47,610 --> 00:01:50,490
Then we have some groupadd options that we can use.

49
00:01:50,490 --> 00:01:52,680
This will allow us to modify this group.

50
00:01:52,680 --> 00:01:54,750
Now by using the option -g,

51
00:01:54,750 --> 00:01:55,680
you can create a group

52
00:01:55,680 --> 00:01:58,200
with a friendly name or a group ID.

53
00:01:58,200 --> 00:02:00,030
By using the -f option,

54
00:02:00,030 --> 00:02:01,770
you can exit with a success status

55
00:02:01,770 --> 00:02:03,750
if the group already exists.

56
00:02:03,750 --> 00:02:05,460
If you use the -o option,

57
00:02:05,460 --> 00:02:07,050
this is used to allow a group to be created

58
00:02:07,050 --> 00:02:09,270
with a non-unique group ID.

59
00:02:09,270 --> 00:02:11,280
The proper way to use the groupadd command

60
00:02:11,280 --> 00:02:13,710
is to enter groupadd, your options,

61
00:02:13,710 --> 00:02:15,390
and then your group name.

62
00:02:15,390 --> 00:02:19,620
For example, I could enter groupadd -g 100 instructors.

63
00:02:19,620 --> 00:02:22,770
This will create a new group called instructors.

64
00:02:22,770 --> 00:02:26,790
Manually editing the /etc/group file is not recommended,

65
00:02:26,790 --> 00:02:28,470
because a typo or other mistake

66
00:02:28,470 --> 00:02:30,930
could render your system unusable.

67
00:02:30,930 --> 00:02:34,260
Instead, you should modify it using the groupmod command.

68
00:02:34,260 --> 00:02:36,960
This will allow you to change the group's own attributes.

69
00:02:36,960 --> 00:02:40,140
By typing -g, you can change the group ID.

70
00:02:40,140 --> 00:02:42,930
By typing -n, you can rename the group.

71
00:02:42,930 --> 00:02:45,090
The proper way to use the groupmod command

72
00:02:45,090 --> 00:02:49,080
is to type groupmod, your options, and then your group name.

73
00:02:49,080 --> 00:02:51,180
Over time, you may find that you need to delete

74
00:02:51,180 --> 00:02:52,786
some of your older groups.

75
00:02:52,786 --> 00:02:55,050
The groupdel command can be used to delete the groups

76
00:02:55,050 --> 00:02:56,670
that you no longer need.

77
00:02:56,670 --> 00:02:58,440
Note though, the groupdel command

78
00:02:58,440 --> 00:03:00,870
will not delete the user accounts that are members

79
00:03:00,870 --> 00:03:02,400
of those groups being deleted.

80
00:03:02,400 --> 00:03:04,860
It only deletes the group itself.

81
00:03:04,860 --> 00:03:06,750
Always be careful when you're deleting groups,

82
00:03:06,750 --> 00:03:09,330
because a mistake here can cause the users of the groups

83
00:03:09,330 --> 00:03:11,370
to no longer be able to access resources

84
00:03:11,370 --> 00:03:13,320
that they need to do their jobs.

85
00:03:13,320 --> 00:03:14,850
The proper way to delete a group

86
00:03:14,850 --> 00:03:17,100
is by entering groupdel, the options,

87
00:03:17,100 --> 00:03:18,300
and then the group name.

