1 00:00:00,680 --> 00:00:05,800 If you have already created a file or directory and needed to change the security settings on it. 2 00:00:05,810 --> 00:00:11,270 If you have different utilities for this purpose are available in Linux, the section and this whole 3 00:00:11,300 --> 00:00:17,570 lecture, you will learn how to change the existing permission, the default owner and the default group 4 00:00:17,570 --> 00:00:19,820 settings for a file or directory. 5 00:00:19,820 --> 00:00:23,210 So my name is Stephan, the complainant or lecturer of our course. 6 00:00:23,210 --> 00:00:24,410 Let's get started. 7 00:00:36,340 --> 00:00:44,110 The mode command allows you to change the security settings for files and directories, the command 8 00:00:44,710 --> 00:00:45,450 mode here. 9 00:00:45,460 --> 00:00:48,070 So the command format is like this. 10 00:00:48,070 --> 00:00:50,350 So firstly you're going to enter the mode. 11 00:00:50,380 --> 00:00:51,910 Then options came here. 12 00:00:51,910 --> 00:00:54,820 Actually, let's hope, let's use the marker here. 13 00:00:54,820 --> 00:00:59,290 So firstly you need to enter the c h mode. 14 00:01:01,740 --> 00:01:07,680 And after that after mode, you will operate the options. 15 00:01:07,800 --> 00:01:08,820 Options. 16 00:01:11,220 --> 00:01:14,400 And after that you will enter the mode. 17 00:01:17,370 --> 00:01:24,450 And after lastly is file that you want to change the comments and permissions on it. 18 00:01:24,570 --> 00:01:26,850 So in order to do that. 19 00:01:27,910 --> 00:01:29,970 The mode parameter here actually. 20 00:01:29,980 --> 00:01:30,430 Oops. 21 00:01:30,430 --> 00:01:30,880 Yeah. 22 00:01:30,910 --> 00:01:38,200 The mode parameter allows you to set the security settings for either octal or symbolic mode. 23 00:01:38,230 --> 00:01:40,930 So the octal mode settings are pretty straightforward. 24 00:01:40,930 --> 00:01:47,470 So just use the standard three digit octal code that you learned in previous lecture. 25 00:01:47,470 --> 00:01:48,790 Remember this here? 26 00:01:48,820 --> 00:01:49,030 Yeah. 27 00:01:49,060 --> 00:01:49,900 Remember this. 28 00:01:50,020 --> 00:01:54,670 This is the permissions and your descriptions in binary and octal. 29 00:01:55,610 --> 00:02:06,080 So if you want to make something like let's create a new file, you know, and torch my new file, we 30 00:02:06,080 --> 00:02:07,280 already have my new file. 31 00:02:07,310 --> 00:02:10,100 Or let's actually my ultra new file. 32 00:02:10,100 --> 00:02:13,370 Yeah, my ultra new file. 33 00:02:13,370 --> 00:02:18,350 And here, let's actually la my ultra new file. 34 00:02:18,350 --> 00:02:21,920 And as you can see, this is following permissions right now. 35 00:02:21,920 --> 00:02:22,420 Right. 36 00:02:22,430 --> 00:02:33,830 Actually, let's open a new here and copy this and make examples from it here as so as you can see, 37 00:02:33,830 --> 00:02:35,000 here we have. 38 00:02:35,850 --> 00:02:36,340 This. 39 00:02:36,360 --> 00:02:37,050 This is just. 40 00:02:37,080 --> 00:02:41,880 We will ignore it at, uh, you will you learn actually this in previous lectures that this is a file 41 00:02:41,880 --> 00:02:42,540 types. 42 00:02:42,540 --> 00:02:44,970 So in this case it's just a regular file. 43 00:02:44,970 --> 00:02:47,370 So we will ignore it and we will copy this. 44 00:02:47,830 --> 00:02:48,720 We will ignore it. 45 00:02:48,720 --> 00:02:49,770 First character. 46 00:02:49,800 --> 00:02:50,760 Copy this. 47 00:02:50,760 --> 00:02:51,600 Actually, let's go. 48 00:02:51,600 --> 00:02:52,080 Here. 49 00:02:52,080 --> 00:02:53,310 So now. 50 00:02:54,400 --> 00:02:54,880 That's it. 51 00:02:55,390 --> 00:02:58,570 Now I will show you right here. 52 00:03:00,670 --> 00:03:02,380 So, as you can see here. 53 00:03:03,610 --> 00:03:05,110 RW is. 54 00:03:06,710 --> 00:03:10,730 RW is 110 then. 55 00:03:11,480 --> 00:03:17,660 Here are minus minus our null null here 101 hundred again. 56 00:03:17,660 --> 00:03:23,810 So after that, in octal, actually we are seeing the six. 57 00:03:25,500 --> 00:03:26,960 Zero zero. 58 00:03:27,330 --> 00:03:35,450 So that the permission for this file is my ultra file. 59 00:03:35,460 --> 00:03:38,130 Is this right? 60 00:03:38,130 --> 00:03:41,730 In octal and here in permission. 61 00:03:41,730 --> 00:03:42,300 Here. 62 00:03:42,300 --> 00:03:43,170 So. 63 00:03:44,790 --> 00:03:51,750 As I said, the mode parameter allows you to set the security settings using either octal or symbolic 64 00:03:51,750 --> 00:03:52,030 mode. 65 00:03:52,050 --> 00:04:00,600 So in order to change this here, for example, mode six, let's actually use 760. 66 00:04:00,600 --> 00:04:04,500 And here let's see what this 160 is. 67 00:04:04,500 --> 00:04:15,930 So seven is rw x, then it comes six RW And after that zero is 000 and that's it. 68 00:04:15,930 --> 00:04:20,160 And so let's see, what is this in? 69 00:04:21,960 --> 00:04:22,800 A binary. 70 00:04:23,380 --> 00:04:29,560 So 111 rw is 110 and 000. 71 00:04:29,800 --> 00:04:30,280 Right. 72 00:04:30,280 --> 00:04:30,820 Yeah. 73 00:04:31,030 --> 00:04:31,600 Here. 74 00:04:31,600 --> 00:04:33,490 And after that it is. 75 00:04:34,850 --> 00:04:37,550 760. 76 00:04:38,480 --> 00:04:47,630 And this is going to be my ultra file, the new my ultra file permission and this new permission. 77 00:04:48,310 --> 00:04:49,000 Here. 78 00:04:50,020 --> 00:04:53,960 Now let's use this mode. 79 00:04:54,430 --> 00:04:58,210 Then your permission and then file or directory name. 80 00:04:58,210 --> 00:05:01,300 In this case, my ultra new file. 81 00:05:01,930 --> 00:05:04,090 And here, let's run it again. 82 00:05:05,400 --> 00:05:06,810 And that's it. 83 00:05:06,930 --> 00:05:10,200 As you can see here, we got the desired result here. 84 00:05:10,200 --> 00:05:11,190 So let's see. 85 00:05:11,190 --> 00:05:14,280 Let's compare these results here. 86 00:05:15,180 --> 00:05:18,720 As you can see here, these are exactly the same result. 87 00:05:18,900 --> 00:05:22,590 So this table will help you in order to use that. 88 00:05:22,590 --> 00:05:27,540 So the Oakdale file permissions are automatically applied, applied to the file indicator. 89 00:05:27,540 --> 00:05:31,980 So the symbolic mode permissions are not so easy to implement. 90 00:05:31,980 --> 00:05:40,260 So instead of using the normal string of three sets of three characters, the Mod command takes a different 91 00:05:40,260 --> 00:05:40,920 approach. 92 00:05:40,920 --> 00:05:41,730 So. 93 00:05:42,680 --> 00:05:43,850 In order to do that. 94 00:05:46,680 --> 00:05:47,310 Here. 95 00:05:47,310 --> 00:05:53,480 So in this mode, firstly you're going to enter mode and then ugoa here. 96 00:05:53,720 --> 00:05:57,210 Yeah, this doesn't make sense, but you will understand here. 97 00:05:57,210 --> 00:05:59,130 So ugoa here. 98 00:05:59,130 --> 00:06:05,100 And after that plus minus or equal, you will enter one of this characters and after that you have this 99 00:06:05,280 --> 00:06:09,610 rw x uppercase to go. 100 00:06:09,660 --> 00:06:11,700 So you will enter one of those here. 101 00:06:13,430 --> 00:06:15,920 This doesn't make perfectly good sense, right? 102 00:06:16,250 --> 00:06:22,970 So the first group of characters defines to whom the new permissions to apply. 103 00:06:24,370 --> 00:06:28,030 That's actually UJO are not like that. 104 00:06:30,020 --> 00:06:31,890 S t ug o. 105 00:06:32,000 --> 00:06:34,460 And here we're going to have the Hugo. 106 00:06:34,520 --> 00:06:35,240 All right. 107 00:06:37,190 --> 00:06:41,570 Who user group or here and so on. 108 00:06:42,080 --> 00:06:43,880 You will have different groups here. 109 00:06:44,890 --> 00:06:45,520 So. 110 00:06:46,570 --> 00:06:52,720 The first group of characters defines to whom the new permission to apply. 111 00:06:53,170 --> 00:06:56,360 In this case, you is. 112 00:06:57,280 --> 00:06:59,460 Yeah, in this case, actually. 113 00:06:59,470 --> 00:06:59,890 Actually. 114 00:07:00,160 --> 00:07:00,910 Sorry for this. 115 00:07:00,910 --> 00:07:04,630 So let's copy this so you can see better here. 116 00:07:04,630 --> 00:07:07,150 So in this case the you. 117 00:07:08,180 --> 00:07:15,710 For user, the G for group and O for others or everyone else. 118 00:07:15,710 --> 00:07:19,730 And R for all of this group is here. 119 00:07:19,730 --> 00:07:28,610 So this will assign to R So the next symbol is used to indicate whether you want to add the permission 120 00:07:28,610 --> 00:07:35,870 to the existing permission with plus subtract the permission from the existing permission from minus 121 00:07:35,900 --> 00:07:39,740 or set the permission to the value. 122 00:07:40,400 --> 00:07:45,410 Finally, the third symbol is the permission used for setting. 123 00:07:45,410 --> 00:07:49,910 So you may notice that there are more than the normal r w x values here. 124 00:07:49,910 --> 00:07:53,060 So the additional settings are here. 125 00:07:53,060 --> 00:07:55,280 So actually let me write that down here. 126 00:07:55,280 --> 00:07:59,570 So here the S is for set. 127 00:08:00,200 --> 00:08:08,150 S is for set s uid or SG ID on execution. 128 00:08:08,150 --> 00:08:09,370 And here we are. 129 00:08:09,380 --> 00:08:23,000 T is for setting sticky bit set sticky bit which I will explain all of this here u is to set set permissions 130 00:08:23,000 --> 00:08:27,290 to the owners owners permission. 131 00:08:28,310 --> 00:08:29,780 The G here. 132 00:08:30,770 --> 00:08:36,140 The G is to set the permissions. 133 00:08:37,090 --> 00:08:37,660 Set. 134 00:08:37,690 --> 00:08:39,100 Permissions. 135 00:08:39,300 --> 00:08:39,570 Oops. 136 00:08:39,580 --> 00:08:43,780 Permissions to the groups. 137 00:08:43,810 --> 00:08:45,340 Groups, Permission. 138 00:08:47,360 --> 00:08:48,230 And. 139 00:08:48,980 --> 00:08:49,280 Your. 140 00:08:50,570 --> 00:09:00,350 And lastly, all here is used for to set permissions to others permission. 141 00:09:01,580 --> 00:09:02,360 So. 142 00:09:04,440 --> 00:09:04,980 Here. 143 00:09:05,520 --> 00:09:09,760 The use for permissions would like this so see mode. 144 00:09:11,230 --> 00:09:11,860 Or. 145 00:09:12,600 --> 00:09:18,870 Plus are my ultra new file. 146 00:09:19,530 --> 00:09:21,480 And let's actually try it again. 147 00:09:21,480 --> 00:09:26,490 And here, as you can see here, we got different results from here. 148 00:09:27,240 --> 00:09:28,020 So. 149 00:09:29,600 --> 00:09:30,140 It's actually. 150 00:09:31,020 --> 00:09:32,430 See what happens. 151 00:09:34,130 --> 00:09:43,550 And this is the actually here, the test one, test two. 152 00:09:43,550 --> 00:09:46,850 And this is test three here. 153 00:09:47,970 --> 00:09:48,600 So. 154 00:09:48,630 --> 00:09:51,740 RW Actually, it's not permission. 155 00:09:51,750 --> 00:09:52,320 Yeah. 156 00:09:52,680 --> 00:09:54,750 One, two, three, and that's it. 157 00:09:54,750 --> 00:10:05,310 So here, as you remember, RW X is 111110 and 100110 and 100. 158 00:10:05,310 --> 00:10:09,270 And here we will have for this 111100. 159 00:10:09,570 --> 00:10:11,490 So seven. 160 00:10:13,550 --> 00:10:18,230 And actually it's the first is seven and then it comes to six. 161 00:10:18,230 --> 00:10:19,550 And lastly. 162 00:10:23,340 --> 00:10:29,090 100 is four and not here for sorry for this. 163 00:10:29,100 --> 00:10:30,390 This is, uh, six. 164 00:10:30,410 --> 00:10:35,730 Four for and seven six and lastly for seven. 165 00:10:35,730 --> 00:10:36,270 Six for. 166 00:10:37,260 --> 00:10:45,090 So the here as you remember here, the O plus R entry also read permission to whatever permission that 167 00:10:45,110 --> 00:10:46,840 everyone security level already had. 168 00:10:46,860 --> 00:10:53,010 So the U minus X and removes the execute permissions that the user already had. 169 00:10:53,010 --> 00:10:56,070 So in order to do that let's actually do this. 170 00:10:57,820 --> 00:10:58,570 C'mon. 171 00:10:59,670 --> 00:11:12,840 C h mode u minus x, And here after that we will use the my ultra new file and a my my ultra new file. 172 00:11:13,350 --> 00:11:17,460 And as you can see here, we just change that. 173 00:11:18,950 --> 00:11:20,760 Let's try that now. 174 00:11:20,780 --> 00:11:24,620 So this one was our my. 175 00:11:25,830 --> 00:11:29,030 My ultra new my ultra file. 176 00:11:29,040 --> 00:11:31,890 They are they made it wrong here. 177 00:11:31,920 --> 00:11:36,240 Test three actually my ultra new file. 178 00:11:37,850 --> 00:11:38,960 New file. 179 00:11:41,750 --> 00:11:43,940 And lastly, new file. 180 00:11:44,900 --> 00:11:46,940 And here we will have this. 181 00:11:47,180 --> 00:11:48,470 Let's load it first. 182 00:11:48,620 --> 00:11:49,430 And here. 183 00:11:49,430 --> 00:11:50,780 One, two, three. 184 00:11:51,950 --> 00:11:58,250 And actually, the second parameters are same, but the first we changed with took the execute permissions 185 00:11:58,250 --> 00:11:58,910 from it. 186 00:11:59,090 --> 00:12:00,410 Let's actually try it now. 187 00:12:00,530 --> 00:12:02,780 Our W was 110. 188 00:12:04,940 --> 00:12:07,280 And again our W was 110. 189 00:12:07,280 --> 00:12:12,140 And lastly our was 1100, which is. 190 00:12:15,060 --> 00:12:16,560 Six, six, four. 191 00:12:17,520 --> 00:12:21,830 And this was our my actually. 192 00:12:21,840 --> 00:12:23,100 Let's test it again. 193 00:12:23,520 --> 00:12:24,690 110. 194 00:12:25,410 --> 00:12:26,340 Six. 195 00:12:26,670 --> 00:12:27,690 Six? 196 00:12:28,880 --> 00:12:29,240 Six. 197 00:12:29,240 --> 00:12:30,860 Six four. 198 00:12:30,890 --> 00:12:32,000 Yeah, that's true. 199 00:12:32,510 --> 00:12:34,190 Ultra new file. 200 00:12:34,400 --> 00:12:36,440 Ultra new file. 201 00:12:36,440 --> 00:12:39,680 And this is test four. 202 00:12:39,980 --> 00:12:41,600 And that's it with our lecture. 203 00:12:41,600 --> 00:12:43,850 I hope and I will also share these files with you. 204 00:12:43,850 --> 00:12:45,080 So I'm waiting you in next lecture.