1 00:00:06,390 --> 00:00:08,610 - So now that you know how to work with users, 2 00:00:08,610 --> 00:00:11,520 you should also know how to work with groups. 3 00:00:11,520 --> 00:00:14,730 So in order to create groups, you use groupadd 4 00:00:14,730 --> 00:00:16,470 followed by the name of the group 5 00:00:16,470 --> 00:00:18,750 and then you can add users to a group 6 00:00:18,750 --> 00:00:23,733 as a secondary group using usermod -aG groupname username. 7 00:00:24,660 --> 00:00:26,133 Let me just show you. 8 00:00:28,110 --> 00:00:29,730 Now, the first that we should explore 9 00:00:29,730 --> 00:00:32,010 is a statement as a secondary group. 10 00:00:32,010 --> 00:00:34,410 What is the thing if I use id on bill 11 00:00:34,410 --> 00:00:36,393 to explore the properties of user bill, 12 00:00:36,393 --> 00:00:39,797 then we can see that while I created user bill, 13 00:00:39,797 --> 00:00:42,723 useradd has also created a group with the name bill. 14 00:00:43,920 --> 00:00:45,090 We can even verify 15 00:00:45,090 --> 00:00:48,507 if I use grep bill on etc group. 16 00:00:48,507 --> 00:00:50,610 Etc group is where the groups are stored. 17 00:00:50,610 --> 00:00:53,310 You can see that group bill is created. 18 00:00:53,310 --> 00:00:55,080 So if it's for the primary group 19 00:00:55,080 --> 00:00:56,730 you don't have to do anything. 20 00:00:56,730 --> 00:00:58,440 If it's for the secondary group 21 00:00:58,440 --> 00:00:59,910 you do need to do something. 22 00:00:59,910 --> 00:01:02,460 So sudo groupadd sales, for instance 23 00:01:02,460 --> 00:01:05,250 is creating a group with the name sales. 24 00:01:05,250 --> 00:01:06,510 We can verify that. 25 00:01:06,510 --> 00:01:09,810 Grep sales in etc group and yay, 26 00:01:09,810 --> 00:01:11,940 the group has been created, 27 00:01:11,940 --> 00:01:14,220 but now I want users to be a member. 28 00:01:14,220 --> 00:01:15,543 Then I need usermod. 29 00:01:17,010 --> 00:01:22,010 So sudo usermod -aG sales bill 30 00:01:24,990 --> 00:01:26,040 is doing what? 31 00:01:26,040 --> 00:01:30,690 This is adding user bill as a member to the group sales. 32 00:01:30,690 --> 00:01:34,530 Now this does not change anything about the ownership. 33 00:01:34,530 --> 00:01:38,490 Let me show you sudo su - bill. 34 00:01:38,490 --> 00:01:39,990 I have no password for bill. 35 00:01:39,990 --> 00:01:42,420 So this is the only way that I can easily get 36 00:01:42,420 --> 00:01:44,400 into a shell is user bill. 37 00:01:44,400 --> 00:01:49,400 And let me create a file with the name bilfile 38 00:01:51,480 --> 00:01:55,770 and ls -l and there we can see ownership is still set 39 00:01:55,770 --> 00:01:57,060 to bill and bill. 40 00:01:57,060 --> 00:01:58,770 Secondary groups are cool, 41 00:01:58,770 --> 00:02:01,740 but secondary groups are mainly to grant permissions 42 00:02:01,740 --> 00:02:03,210 to additional items. 43 00:02:03,210 --> 00:02:06,273 They are not used for ownership by default.