1 00:00:06,540 --> 00:00:09,169 In this video, we'll talk about creating groups. 2 00:00:10,650 --> 00:00:14,179 Creating groups requires GroupAdd. It's pretty simple. Use groupadd followed 3 00:00:14,179 --> 00:00:17,710 by the group name to create a new group. 4 00:00:18,809 --> 00:00:24,809 And if you want to add users to a group as a secondary group, 5 00:00:24,809 --> 00:00:30,809 then you use user mod ag, group name username. Now, what is this ag 6 00:00:30,810 --> 00:00:36,810 about? Well, user mod G requires you to specify a list of secondary groups. 7 00:00:37,659 --> 00:00:43,079 This list of secondary groups will override all current secondary group assignments. So if you 8 00:00:43,079 --> 00:00:48,500 want to add users to a new secondary group without removing them from currently existing 9 00:00:48,500 --> 00:00:53,920 secondary groups, you use user mod ag on the group name. Let me demonstrate. 10 00:00:54,920 --> 00:01:00,130 So let's start with ID on user Anna. And we can see that user Anna is a member of the group 1004. 11 00:01:01,049 --> 00:01:02,890 That's a private group. 12 00:01:03,390 --> 00:01:07,019 Now I'm going to use sudo group add sales. 13 00:01:08,540 --> 00:01:12,500 And then I'm going to use sudo 14 00:01:12,500 --> 00:01:16,459 user mod a uppercase g sales Anna. 15 00:01:17,239 --> 00:01:22,114 So now let's do ID Anna to figure out what user Anna has as configuration. 16 00:01:22,114 --> 00:01:26,989 So user Anna is a member of group Anna as well as group Sales. 17 00:01:27,609 --> 00:01:31,210 Now let me show you the wrong approach. I'm 18 00:01:31,210 --> 00:01:34,810 going to use user mod g wheel for Anna. 19 00:01:35,450 --> 00:01:40,459 And then I'm repeating my I.D. anna. And look at that, she's no longer a member of the group sales. 20 00:01:41,359 --> 00:01:43,819 That is why we really needed this. 21 00:01:44,640 --> 00:01:50,704 A for append and g for uppercase g. And that will make sure that the 22 00:01:50,704 --> 00:01:56,769 user is added to the group without overwriting any of the existing group memberships.