1 00:00:00,210 --> 00:00:05,700 Now, let's put this command and you can see that we have the long list format. 2 00:00:06,240 --> 00:00:08,920 Now it's time to talk about all of this. 3 00:00:09,190 --> 00:00:10,370 Well, actually, not all of them. 4 00:00:10,620 --> 00:00:15,990 First now let's talk about the first part, which is that this part and what is this? 5 00:00:15,990 --> 00:00:16,620 What is this? 6 00:00:16,830 --> 00:00:20,880 OK, now you can see that we have the first part, which is this. 7 00:00:21,090 --> 00:00:29,350 Now we have this symbol, which is the or this letter D or minus dash, let's say, or sometimes it's 8 00:00:29,370 --> 00:00:30,230 and or something else. 9 00:00:30,240 --> 00:00:30,810 What are those? 10 00:00:30,990 --> 00:00:32,890 Well, actually, this is the type of the file. 11 00:00:33,150 --> 00:00:36,150 So the here as you can see, they are one remoting. 12 00:00:36,150 --> 00:00:39,150 These are the deed which means directly. 13 00:00:39,430 --> 00:00:45,810 OK, now the splashier sorry, the decir as you can see here for this or they stick to your text file 14 00:00:45,810 --> 00:00:46,900 or this too. 15 00:00:47,220 --> 00:00:48,630 These are a regular file. 16 00:00:48,910 --> 00:00:57,410 OK, now if we have a list, so let's have a directory so linked to, to there to anything it's OK. 17 00:00:58,290 --> 00:01:01,780 It's as a symbol or as a symmetric. 18 00:01:02,340 --> 00:01:07,530 Now if we have it again now we have an OK, now this is just arbitrary link. 19 00:01:07,680 --> 00:01:11,880 OK, so now we have an L means a link fight. 20 00:01:12,060 --> 00:01:17,340 OK, now actually there are other files like bypass which are a lot of things you can read about it, 21 00:01:17,340 --> 00:01:18,930 but these are the most important ones. 22 00:01:19,050 --> 00:01:20,850 The directory, the text files. 23 00:01:21,030 --> 00:01:23,970 We have the files or link list funds. 24 00:01:24,210 --> 00:01:24,600 OK. 25 00:01:25,350 --> 00:01:26,070 So far so good. 26 00:01:26,460 --> 00:01:30,490 Now it's time for the BATO, which is these bits. 27 00:01:30,540 --> 00:01:31,430 Now what are those? 28 00:01:31,650 --> 00:01:33,190 As you can see, we have read, right? 29 00:01:33,210 --> 00:01:34,590 Execute, read, write, execute. 30 00:01:34,590 --> 00:01:36,440 Or are they are they are the. 31 00:01:36,780 --> 00:01:43,510 What are those actually these are four that read and execute are for beautiful. 32 00:01:43,620 --> 00:01:44,020 Right. 33 00:01:44,070 --> 00:01:44,970 X for execute. 34 00:01:45,150 --> 00:01:47,520 But we have, we will have them duplicates. 35 00:01:47,520 --> 00:01:48,210 What are those. 36 00:01:48,210 --> 00:01:54,100 Please read, write, execute then we have read, write, execute and then we have a third rewrite execute. 37 00:01:54,330 --> 00:02:01,440 Now actually these are for the user which is the owner of the file, which is Open-top in my case here, 38 00:02:02,340 --> 00:02:08,610 the group, the second three bits, which is for the owner group or the group for this file or this 39 00:02:08,610 --> 00:02:11,010 directory, which is in my case as well. 40 00:02:11,010 --> 00:02:18,640 It is Ubuntu and we have the read write execute the third bits, which is for that others. 41 00:02:18,670 --> 00:02:25,710 Others, which means that any other user or group on the system can have either read, write or execute 42 00:02:25,920 --> 00:02:29,950 or the three, the three of them which is written to execute in my case. 43 00:02:30,240 --> 00:02:35,790 So anyone in the system can read and write and execute on this directory, which is something that I 44 00:02:35,790 --> 00:02:36,050 know. 45 00:02:36,150 --> 00:02:41,850 But just for me, by the way, they wrote that actually doesn't have this permission only for the owner, 46 00:02:41,850 --> 00:02:47,490 which is the owner, not even for the group, not only for the owner, which is something more secure 47 00:02:47,760 --> 00:02:52,860 because only the road user can do whatever it wants with this specific secret file. 48 00:02:52,890 --> 00:02:53,230 OK. 49 00:02:53,430 --> 00:02:53,810 All right. 50 00:02:54,060 --> 00:02:56,230 Now, I want you to follow me now. 51 00:02:56,230 --> 00:02:59,640 How to change that permission for this file. 52 00:02:59,820 --> 00:03:03,050 OK, we have to do we will start testing on the dire one. 53 00:03:03,180 --> 00:03:06,760 OK, or actually let's have on t the text, OK. 54 00:03:07,530 --> 00:03:13,560 The first thing I want to remove the key to the text because they are a linked list actually, so we 55 00:03:13,560 --> 00:03:15,000 don't need to get confused here. 56 00:03:15,450 --> 00:03:19,740 So unless nationally or we can have this one. 57 00:03:19,740 --> 00:03:20,880 That is the text. 58 00:03:20,910 --> 00:03:21,310 OK. 59 00:03:21,810 --> 00:03:22,320 All right. 60 00:03:22,650 --> 00:03:28,560 Now for changing the user mode, we need to use that segment, which is change mode. 61 00:03:28,810 --> 00:03:30,670 OK, g change mode. 62 00:03:30,720 --> 00:03:37,140 We have two ways of changing the one we have the binary mode or the number number or we have the second 63 00:03:37,140 --> 00:03:38,140 way, which is the letter. 64 00:03:38,460 --> 00:03:40,150 OK, using that Hugo. 65 00:03:40,350 --> 00:03:41,370 OK, now we would hand. 66 00:03:41,610 --> 00:03:42,230 What if we. 67 00:03:42,600 --> 00:03:43,240 So don't worry. 68 00:03:43,740 --> 00:03:48,600 So the first thing let's have search mode then we provide that permission here. 69 00:03:48,750 --> 00:03:52,920 OK, then we put the name of the file which is the text in my case. 70 00:03:53,080 --> 00:04:00,690 OK, now what are the permission I would want or I will start with that numeric way or the numbers. 71 00:04:01,020 --> 00:04:07,290 OK, now I would put a binary value translated from that integer. 72 00:04:08,260 --> 00:04:09,490 To get what we want. 73 00:04:09,530 --> 00:04:16,720 OK, now, again, we have for the user and work for the group and for the other user, which is the 74 00:04:16,720 --> 00:04:17,490 owner of the pipe. 75 00:04:17,690 --> 00:04:19,030 OK, sorry for this one. 76 00:04:19,240 --> 00:04:25,130 OK, so the first part, which is very dry, execute for the owner. 77 00:04:25,510 --> 00:04:26,880 Now the Reid. 78 00:04:27,760 --> 00:04:34,750 It will give you for follow me for the right, which is the bit, it will give you two and they execute, 79 00:04:34,750 --> 00:04:35,620 it will give you one. 80 00:04:35,620 --> 00:04:39,040 So it will be start from here one to four. 81 00:04:39,250 --> 00:04:43,330 So depends on what you want calculate and some of the permission you want then. 82 00:04:43,330 --> 00:04:43,950 But the value. 83 00:04:44,080 --> 00:04:52,540 So for example, I wanted to be read, write, execute so I will some one plus two plus three plus four 84 00:04:52,660 --> 00:04:55,060 which means four which means seven. 85 00:04:55,570 --> 00:04:59,930 Four plus three which means so seven sevens mean read, write, execute. 86 00:05:00,190 --> 00:05:01,940 Now this is for the owner. 87 00:05:02,150 --> 00:05:05,310 Now let's start with that group which is read right. 88 00:05:05,350 --> 00:05:13,180 Execute another thing I need to bet I need it to be read execute only so I will calculate or I will 89 00:05:13,600 --> 00:05:18,160 some one plus four which is read and execute. 90 00:05:18,160 --> 00:05:19,090 Execute is one. 91 00:05:19,310 --> 00:05:21,750 Right is to read is four. 92 00:05:22,210 --> 00:05:25,410 OK, so four plus one which means five. 93 00:05:25,450 --> 00:05:26,530 So it will be fine. 94 00:05:26,830 --> 00:05:33,510 Now for the last part, which is the other part, I want it to be zero, which means no read not I have 95 00:05:33,520 --> 00:05:34,180 not executed. 96 00:05:34,400 --> 00:05:38,950 OK, so it will be zero so it will be seven hundred and fifty. 97 00:05:39,280 --> 00:05:42,880 And now if I type it like this and if I type as well. 98 00:05:43,060 --> 00:05:48,330 And let's have a comparison between this one and this one so you can see that here we have read write 99 00:05:48,340 --> 00:05:50,170 without execute, which means dash. 100 00:05:50,500 --> 00:05:56,290 Dash here means no but has been set which means no execution here. 101 00:05:56,290 --> 00:05:57,030 No right. 102 00:05:57,370 --> 00:05:59,890 Fit on here, no execution bit. 103 00:06:00,340 --> 00:06:06,010 But here after we done it, now we have read that I can execute so you can see that execute has been 104 00:06:06,010 --> 00:06:11,920 added, read, executed only, which means that execute has been added and the right has been removed. 105 00:06:12,130 --> 00:06:15,340 And we have that and that. 106 00:06:15,640 --> 00:06:16,690 Oh sorry Dash. 107 00:06:16,690 --> 00:06:19,420 That's Dash, which means no permission at all for the others. 108 00:06:19,660 --> 00:06:22,360 But so you can see comparison with here. 109 00:06:22,720 --> 00:06:24,890 We removed the grid as well. 110 00:06:25,270 --> 00:06:25,810 All right. 111 00:06:26,020 --> 00:06:26,740 So far so good. 112 00:06:26,770 --> 00:06:28,450 Now this is the first method. 113 00:06:28,600 --> 00:06:30,160 Now it depends on you what you want. 114 00:06:30,160 --> 00:06:36,790 So read, only write, only executed, only read, executed, read, write, execute, write, execute, 115 00:06:36,790 --> 00:06:42,670 write with read, read with only execute only whatever you want, whatever you want. 116 00:06:42,880 --> 00:06:43,960 Depends on that. 117 00:06:44,260 --> 00:06:46,720 But with the permission you want. 118 00:06:46,720 --> 00:06:47,920 Five five five for example. 119 00:06:48,070 --> 00:06:50,800 And the name of the file you want to change the permission for. 120 00:06:51,070 --> 00:06:55,140 OK, ok now this is the first way OK. 121 00:06:55,260 --> 00:07:02,710 And again, not just the second way which is using the letters way now we would have there you go. 122 00:07:03,130 --> 00:07:13,540 Which means user group either on Hulu Plus minus Equant and then provided that I execute OK and we have 123 00:07:13,540 --> 00:07:18,340 the S but the US, which is the special permission, we will talk about it later on in this lecture. 124 00:07:18,370 --> 00:07:18,850 Don't worry. 125 00:07:19,920 --> 00:07:20,440 All right. 126 00:07:20,680 --> 00:07:25,320 No, actually, this is the most prepared way that everyone use it. 127 00:07:26,010 --> 00:07:31,830 They will not use the binary way they use this way because this is much readable, human human readable, 128 00:07:31,830 --> 00:07:32,370 actually. 129 00:07:32,400 --> 00:07:38,610 And actually, from my opinion, I use this again, it depends on what you prefer and so on. 130 00:07:38,730 --> 00:07:40,640 So, yeah, you prefer that way. 131 00:07:40,660 --> 00:07:44,480 You are used to that way it's OK or you want to get used to that way it's OK. 132 00:07:44,790 --> 00:07:51,350 But from my opinion, it's better to have as simple as possible because when things go down, when you 133 00:07:51,360 --> 00:07:56,400 are for example, you are a database engineer on this company and this company servers is going down 134 00:07:56,760 --> 00:07:59,280 and you want to change information or you want to do something. 135 00:07:59,490 --> 00:08:06,260 So it's better to have a simple approach because the errors or the human errors will be less than when 136 00:08:06,300 --> 00:08:08,400 combat is if you are using a complex week. 137 00:08:08,570 --> 00:08:10,620 OK, well, actually this is my opinion. 138 00:08:10,620 --> 00:08:12,540 After all, you choose what you want. 139 00:08:12,730 --> 00:08:15,020 OK, now let's start for example. 140 00:08:15,030 --> 00:08:15,690 Now let's see. 141 00:08:15,690 --> 00:08:17,790 Have this fight. 142 00:08:17,940 --> 00:08:22,010 We have read, write, execute, read, execute, and we have nothing for the other. 143 00:08:22,500 --> 00:08:29,310 So, for example, I want for the user to have the right to execute and the group to have read execute 144 00:08:29,310 --> 00:08:30,830 and the other to have execute. 145 00:08:31,290 --> 00:08:34,030 No, actually I will I will talk about it this fast. 146 00:08:34,050 --> 00:08:41,750 So the first thing that you and G and or equal read, write, execute. 147 00:08:42,120 --> 00:08:48,390 So this will give you as you can see, we have equal, we have plus, we have minus here plus at minus. 148 00:08:48,560 --> 00:08:50,160 Remove this equal. 149 00:08:50,370 --> 00:08:51,870 It would be absolute like this. 150 00:08:52,080 --> 00:08:55,690 So t the text file which is the name of the file sort of this. 151 00:08:56,180 --> 00:08:56,520 Yeah. 152 00:08:57,060 --> 00:09:03,840 So see what the user or the owner, the group and other equal rights to execute and let's have it here. 153 00:09:03,960 --> 00:09:10,740 So if I type special you can see that this time it is read, write, execute, execute, read, write, 154 00:09:10,740 --> 00:09:11,220 execute. 155 00:09:11,250 --> 00:09:11,640 All right. 156 00:09:11,940 --> 00:09:19,380 Now actually we can have it again which is sigmoid Euge all this time, minus read, write, execute 157 00:09:19,560 --> 00:09:20,310 as you can see. 158 00:09:20,700 --> 00:09:27,180 And what the T of the text which is this time the user and the owner, the group remove the read and 159 00:09:27,180 --> 00:09:28,510 write and execute. 160 00:09:28,530 --> 00:09:29,790 So let's put it like this. 161 00:09:29,790 --> 00:09:35,670 And as Deshotel And you can see that the t the text file has no permission at all. 162 00:09:35,870 --> 00:09:36,410 All right. 163 00:09:36,510 --> 00:09:37,380 So far so good. 164 00:09:37,560 --> 00:09:44,580 Again, see Etemad Ugelow plus read execute or without special. 165 00:09:45,900 --> 00:09:49,320 Plus, execute to the text file. 166 00:09:49,500 --> 00:09:54,270 OK, so this will give us only read right for everything, which is this one. 167 00:09:54,690 --> 00:10:00,480 It's clear the screen and let's have another look what actually instead of using that or because you 168 00:10:00,480 --> 00:10:01,890 are, I think to everyone. 169 00:10:01,890 --> 00:10:03,150 To all you use. 170 00:10:03,160 --> 00:10:06,850 Oh, a I mean it equal read. 171 00:10:06,900 --> 00:10:07,140 Right. 172 00:10:07,170 --> 00:10:09,210 Execute to the to the text file. 173 00:10:09,420 --> 00:10:11,850 OK, now let's have a look here. 174 00:10:11,880 --> 00:10:13,560 It means all everyone. 175 00:10:13,560 --> 00:10:15,060 So they use the group the order. 176 00:10:15,180 --> 00:10:16,470 So if you look here. 177 00:10:16,510 --> 00:10:16,920 Yeah. 178 00:10:17,400 --> 00:10:23,280 This time instead of rewrite only it would be read, write, execute, execute, read, write, execute. 179 00:10:23,400 --> 00:10:24,390 So far so good. 180 00:10:24,840 --> 00:10:27,750 For example, if you want the other to be nothing. 181 00:10:27,780 --> 00:10:33,470 OK, so you can just the other minus read, write, execute the text. 182 00:10:33,690 --> 00:10:40,380 So this would remove the read and write and execute from the text file so that I forget about the statement 183 00:10:40,380 --> 00:10:40,630 here. 184 00:10:40,680 --> 00:10:41,060 Sorry. 185 00:10:41,440 --> 00:10:41,830 Yeah. 186 00:10:43,560 --> 00:10:45,340 I thought it would be no read. 187 00:10:45,350 --> 00:10:45,730 No right. 188 00:10:45,750 --> 00:10:47,510 No execute as simple as that. 189 00:10:47,520 --> 00:10:50,590 And if I type it here you can see that it is very simple. 190 00:10:50,760 --> 00:10:52,220 No actually it is better. 191 00:10:52,590 --> 00:10:58,200 I will not tell you every situation here or in the case, but it's better to have a real hands on. 192 00:10:58,380 --> 00:11:05,450 Please open your terminal, get your hands dirty and try everything possible for your this temporary 193 00:11:05,450 --> 00:11:06,420 device, whatever. 194 00:11:06,420 --> 00:11:07,650 Fine you have now. 195 00:11:07,650 --> 00:11:08,460 Enough with that. 196 00:11:08,740 --> 00:11:10,860 Let's talk about another subject now. 197 00:11:10,860 --> 00:11:17,370 I want to talk about what is the difference between the directory and the regular file as read or write 198 00:11:17,370 --> 00:11:18,180 or execute. 199 00:11:18,450 --> 00:11:18,990 Execute. 200 00:11:19,290 --> 00:11:22,940 So as I read, yeah, the text file is readable. 201 00:11:23,010 --> 00:11:30,600 So let's have a comparison between the text and let's make a directory, name it Dir and S, for example, 202 00:11:30,600 --> 00:11:31,740 or dial one. 203 00:11:32,580 --> 00:11:37,200 But for that it's removed and remove that one. 204 00:11:39,650 --> 00:11:47,090 And they still move there as well, and this would get Ashara, so unless this all this time we don't 205 00:11:47,090 --> 00:11:50,530 have them, so let's remove their tube as well. 206 00:11:52,680 --> 00:11:58,830 So you can see that we don't have them, let's make an directory and it's name one, OK, so it has 207 00:11:58,830 --> 00:12:03,040 to have a here look, you dial one and we have to text, OK? 208 00:12:05,280 --> 00:12:13,740 No, for that file or the regular file, which is text readable, it means I can concatenated I can 209 00:12:14,250 --> 00:12:16,590 I can open it using any text editor. 210 00:12:16,620 --> 00:12:19,200 OK, so you can see that it can be readable. 211 00:12:19,230 --> 00:12:25,490 So if I take the text, you can see that we have this arbitrary lines or arbitrary text, whatever. 212 00:12:25,720 --> 00:12:34,590 OK, but if I removed that permission from everyone, which is all my notes are OK, I will remove the 213 00:12:34,590 --> 00:12:42,590 reading permission by the way, you can instead of a minus R, you can put just minus R and the T the 214 00:12:42,610 --> 00:12:42,990 text. 215 00:12:43,170 --> 00:12:44,220 This will work as well. 216 00:12:44,250 --> 00:12:48,120 OK, so if you have a look here, nothing is readability. 217 00:12:48,120 --> 00:12:49,890 The text is no treatment. 218 00:12:49,920 --> 00:12:53,190 So t ditech the text, permission denied. 219 00:12:53,340 --> 00:12:58,980 Even though you can see that I am the owner of the file, you can see that I am the owner of the Y by 220 00:12:58,980 --> 00:12:59,320 the way. 221 00:12:59,490 --> 00:13:01,040 This will not work on the user. 222 00:13:01,050 --> 00:13:09,510 So if I type Sue Cat and don't worry about this, we will talk about it in a separate lecture and full 223 00:13:09,510 --> 00:13:11,160 details about the pseudo what is. 224 00:13:11,160 --> 00:13:17,520 But for now, keeping your mind, Sudo is used to run specific commands as another as another user, 225 00:13:17,520 --> 00:13:20,150 which is in my case, as the rule is. 226 00:13:20,250 --> 00:13:26,670 So I'm running the cat as the full permission user, which is the root user cat t the text. 227 00:13:27,060 --> 00:13:34,320 You can see that even though you can see that no one has read but enabled, you can see that root the 228 00:13:34,320 --> 00:13:42,030 root user, which is by you doing this command, is able to read the file because this is the user, 229 00:13:42,090 --> 00:13:48,630 which means the full permission user can read anything, can do anything, is the owner of the system. 230 00:13:49,410 --> 00:13:54,510 So that's why it's very dangerous to have him or to have this user compromised. 231 00:13:55,200 --> 00:13:57,030 Anyway, it's let's turn back. 232 00:13:57,300 --> 00:13:57,650 All right. 233 00:13:57,840 --> 00:14:02,220 So we saw what means the need for the search mode. 234 00:14:02,460 --> 00:14:08,310 Again, let's but please increase the read for the text or a t the text. 235 00:14:08,310 --> 00:14:08,730 It's OK. 236 00:14:09,360 --> 00:14:11,670 Read for the text. 237 00:14:11,670 --> 00:14:12,090 It's OK. 238 00:14:12,090 --> 00:14:12,810 It will do the job. 239 00:14:13,770 --> 00:14:21,360 But it's clear the screen and again now this is read before the fight for the right to fight, it is 240 00:14:21,360 --> 00:14:24,710 the same so I can write content to this fight. 241 00:14:25,110 --> 00:14:27,030 By the way, this is the beat on the other. 242 00:14:28,060 --> 00:14:30,100 The owner of the group or the other. 243 00:14:30,130 --> 00:14:38,630 So if I have for the owner, right, but without right and on the group I have as I write for the others, 244 00:14:38,650 --> 00:14:43,780 I have it as right when actually the owner will not be able to write it on the file, but the others 245 00:14:43,930 --> 00:14:45,340 will be able to identify it. 246 00:14:45,580 --> 00:14:47,590 By the way, this is this doesn't make sense. 247 00:14:47,590 --> 00:14:50,240 I know, but just keep that in your mind. 248 00:14:50,510 --> 00:14:57,670 OK, so for regular text file to redefine the right tool, write to the fight or modify the fight and 249 00:14:57,670 --> 00:15:01,050 execute if you want this fight to be executable. 250 00:15:01,070 --> 00:15:04,310 So you are writing about your script by the script BHB, whatever. 251 00:15:04,690 --> 00:15:06,460 So you want it to be executable. 252 00:15:06,790 --> 00:15:08,290 OK, now this is the first thing. 253 00:15:09,430 --> 00:15:12,080 Fought this fight, but fought a directory. 254 00:15:12,140 --> 00:15:15,880 OK, this is different now, so, yeah, it is very simple. 255 00:15:16,120 --> 00:15:20,770 You can read the content of the directory, which means what are the directory inside it? 256 00:15:20,780 --> 00:15:24,000 What are the regular parts inside and so on for the right. 257 00:15:24,280 --> 00:15:25,000 Very simple. 258 00:15:25,330 --> 00:15:31,390 You can modify the directory so you can create new directories inside that you can identify its name, 259 00:15:31,390 --> 00:15:38,630 by the way, in which by which means file its name and modify the content either in a regular order. 260 00:15:39,380 --> 00:15:46,000 OK, and we can create a text file inside this directory, which is the right of it, which means this 261 00:15:46,150 --> 00:15:47,080 data is right. 262 00:15:47,330 --> 00:15:50,770 But finally, what is the execute bit for the directory? 263 00:15:51,920 --> 00:15:58,280 We know that what is what it is for the regular schedule of by, which means this fight is executable 264 00:15:58,280 --> 00:16:00,980 to execute commands that script both and whatever. 265 00:16:00,980 --> 00:16:05,510 But for the directory, the executable actually is go inside it. 266 00:16:05,570 --> 00:16:10,480 So execute a specific directory means I can go inside this directory. 267 00:16:10,730 --> 00:16:11,400 Now, let's see. 268 00:16:11,420 --> 00:16:12,400 Have this year. 269 00:16:12,680 --> 00:16:19,010 So let's have sigmoid execute, let's remove the execute from everyone on that one. 270 00:16:19,280 --> 00:16:24,740 OK, so I'll ask Deshotel now we don't have any execute permission on this one. 271 00:16:24,920 --> 00:16:29,820 So if I try to go inside it, even though I am the owner of this, you can see that permission denied. 272 00:16:29,990 --> 00:16:30,430 All right. 273 00:16:30,650 --> 00:16:36,090 So even if I type S, by the way, you can see that it is readable for everyone where it is here. 274 00:16:36,440 --> 00:16:44,060 Yeah, it is readable for everyone other on the group, whatever are one. 275 00:16:44,510 --> 00:16:50,050 You can see that I am able to read what is inside it, but I cannot do or create anything inside it. 276 00:16:50,240 --> 00:16:57,430 So if I create the directory or let's create a text file or anyway let's create a directory inside it, 277 00:16:57,770 --> 00:16:59,060 so let's name it down too. 278 00:16:59,210 --> 00:17:01,760 But this time we want it to be inside that one. 279 00:17:02,120 --> 00:17:04,890 So yeah, you can see that their mission is the. 280 00:17:05,480 --> 00:17:11,210 Why is that actually even though I am I the owner which is open to as you can see, I am open to it 281 00:17:11,570 --> 00:17:13,400 and I have the right permission. 282 00:17:13,880 --> 00:17:20,980 You can see even my group have permission, but you can see that because I am not able to go inside 283 00:17:21,200 --> 00:17:29,630 because actually under the hood that command what is this command do actually is go inside the directory, 284 00:17:29,630 --> 00:17:31,070 which they are one. 285 00:17:31,070 --> 00:17:34,430 And then we create a directory called diatom. 286 00:17:34,610 --> 00:17:39,740 So that's why I, I can't I don't have the permission to go inside the dial one. 287 00:17:39,900 --> 00:17:45,560 OK, again, by the way, if you are using the swedo or the root command sorry, the SUDA command with 288 00:17:45,830 --> 00:17:49,940 the route permission and privilege, you are able to do whatever you want. 289 00:17:50,090 --> 00:17:52,490 OK, because this is the king on the system. 290 00:17:52,700 --> 00:17:54,860 It will, it can do anything you want. 291 00:17:55,040 --> 00:17:55,520 All right. 292 00:17:55,610 --> 00:17:58,010 Now we have talked enough about the permission. 293 00:17:58,340 --> 00:18:03,380 Now, we didn't talk anything about how to change the owner or the group of this file. 294 00:18:03,650 --> 00:18:06,080 OK, actually, we have two commands. 295 00:18:06,590 --> 00:18:07,700 We have the cat on. 296 00:18:08,150 --> 00:18:13,250 This is to change either the owner or the group, by the way, or the group and the owner. 297 00:18:13,520 --> 00:18:20,960 And we have that change grb, which is change group, OK, and this is to change the group of this file 298 00:18:20,990 --> 00:18:21,840 or directory. 299 00:18:21,860 --> 00:18:26,930 OK, let's try have a hands on real quick, so on. 300 00:18:27,680 --> 00:18:37,030 So this time I will choose another user name artist, for example, change owner just to the the text. 301 00:18:37,040 --> 00:18:42,230 But maybe this will not work because actually the test is not a real user actually. 302 00:18:42,560 --> 00:18:45,740 So I want to change it this time for the root user. 303 00:18:45,740 --> 00:18:47,630 OK, so I brought. 304 00:18:48,740 --> 00:18:50,540 You can see that operation that's permitted. 305 00:18:50,780 --> 00:18:53,930 Yeah, how can you change it to a route which is the computer? 306 00:18:54,260 --> 00:18:59,570 So you can't do that actually, so you need permission for that and you need for that. 307 00:18:59,570 --> 00:19:01,720 You need to provide the document. 308 00:19:01,730 --> 00:19:04,860 OK, and by the way, I have this shortcut for you. 309 00:19:04,970 --> 00:19:12,320 So instead of taking this and type the document, you can type the pseudo shift one one, which means 310 00:19:12,320 --> 00:19:13,460 the exclamation mark. 311 00:19:13,680 --> 00:19:19,640 And here to run the previous command, which is this one, which is a strange route to the key, the 312 00:19:19,640 --> 00:19:21,110 text with pseudo permission. 313 00:19:21,530 --> 00:19:27,350 And if I type it here, you can see that, yeah, it worked fine, which is and it print what is the 314 00:19:27,350 --> 00:19:30,680 previous command, which is pseudocyesis en route to the text. 315 00:19:31,040 --> 00:19:31,640 And here. 316 00:19:31,790 --> 00:19:33,590 Yeah, you can see that t the text. 317 00:19:33,590 --> 00:19:38,380 Now as you can see here previously it was, it was 012 but here it is. 318 00:19:38,390 --> 00:19:38,750 What. 319 00:19:39,920 --> 00:19:46,070 So if I try to read it or do whatever I want, so actually maybe I can because I am the group after 320 00:19:46,070 --> 00:19:46,200 all. 321 00:19:46,220 --> 00:19:50,990 Here you can see that I am inside the group that I went to group anyway. 322 00:19:50,990 --> 00:19:51,490 Who cares? 323 00:19:51,500 --> 00:19:52,010 It's say. 324 00:19:53,940 --> 00:19:56,400 Yeah, you can see that I am able, even though. 325 00:19:57,510 --> 00:20:05,670 And the owner is the old, but maybe because it is you have other permission to read the file anyway. 326 00:20:05,770 --> 00:20:06,410 No, nobody. 327 00:20:06,870 --> 00:20:08,430 Now, what if I want to change? 328 00:20:09,390 --> 00:20:10,590 It's clear the screen first. 329 00:20:10,590 --> 00:20:13,310 I want to change the owner and the group or the group. 330 00:20:13,320 --> 00:20:16,230 So see the grb and brought. 331 00:20:16,680 --> 00:20:22,470 By the way, every user created on Linux has a group. 332 00:20:22,470 --> 00:20:26,970 So I want to use up have a group called Ubuntu Group as well. 333 00:20:27,070 --> 00:20:27,450 OK. 334 00:20:28,500 --> 00:20:31,810 So road user has a road group as well. 335 00:20:31,830 --> 00:20:38,910 So she wrote Kenja group, as you can see, a change group wrote for the team that X, Y and course 336 00:20:38,910 --> 00:20:39,810 we need a permission. 337 00:20:39,810 --> 00:20:43,110 So so pseudo shift one, shift one, which is exclamation mark. 338 00:20:43,260 --> 00:20:43,880 And yeah. 339 00:20:43,900 --> 00:20:45,300 So I type it like this. 340 00:20:45,420 --> 00:20:52,950 You can see this time that honor is brought and OK, now what if I want to change this route and the 341 00:20:52,950 --> 00:20:55,140 group route with one command. 342 00:20:55,140 --> 00:20:55,940 I don't need that. 343 00:20:55,950 --> 00:20:59,730 So actually I need to provide so we don't see it on this time. 344 00:20:59,940 --> 00:21:02,000 But you may ask me how to do that. 345 00:21:02,010 --> 00:21:04,260 Yeah, actually, you put the name of the user. 346 00:21:04,260 --> 00:21:05,220 We already saw that. 347 00:21:05,790 --> 00:21:08,570 And in my case I wanted to be open to our youth. 348 00:21:08,730 --> 00:21:15,210 But now they could then provide the open talk as well to the text, which is the name of this would 349 00:21:15,660 --> 00:21:22,010 change the owner, which is the user and the owner group, which is going to and actually in my mission, 350 00:21:22,030 --> 00:21:29,220 from my opinion, it's better to have Cichon because it is much newer than the GRB. 351 00:21:29,730 --> 00:21:31,260 But it depends on you what you prepare. 352 00:21:32,040 --> 00:21:33,000 Everything would work. 353 00:21:33,660 --> 00:21:35,670 No performance here, nothing security. 354 00:21:36,020 --> 00:21:36,650 It will do. 355 00:21:36,660 --> 00:21:38,880 It's just your preferences. 356 00:21:39,090 --> 00:21:40,620 OK, so let's have a look here. 357 00:21:41,040 --> 00:21:42,420 Yeah, yeah. 358 00:21:42,510 --> 00:21:49,300 You can see that I am able now to change the owner and the group of the ti the text and it worked fine. 359 00:21:49,520 --> 00:21:53,060 OK, now we have another command which is the idea. 360 00:21:53,340 --> 00:22:00,210 So actually id here if you can see if I type it, if I type meant ID because it will print the real 361 00:22:00,210 --> 00:22:03,990 and effective user and group ID of the current user. 362 00:22:04,230 --> 00:22:11,040 So the current user I have, which is Ubuntu if I type ID, you can see that this is the user ID. 363 00:22:12,810 --> 00:22:19,050 Which is one thousand, this is the guide, which is 1000, the groups I am in, which is open to and 364 00:22:19,050 --> 00:22:20,190 this is the idea for it. 365 00:22:20,190 --> 00:22:27,000 As you can see, um, here are some of the information from some of the groups. 366 00:22:27,000 --> 00:22:30,320 I am inside that so you can see that I am inside the pseudo group. 367 00:22:30,900 --> 00:22:31,770 Don't worry about this. 368 00:22:31,890 --> 00:22:32,100 Do it. 369 00:22:32,100 --> 00:22:35,540 We would have a detailed lecture about it. 370 00:22:35,610 --> 00:22:36,460 Don't worry at all. 371 00:22:36,810 --> 00:22:40,230 And here are some of the other groups for the system. 372 00:22:40,230 --> 00:22:42,300 Actually, it doesn't matter. 373 00:22:42,450 --> 00:22:47,250 OK, so you can see that by typing the ID we know what are the group? 374 00:22:47,700 --> 00:22:50,830 The window is inside, which is a window adiam. 375 00:22:51,180 --> 00:22:57,480 They are allowed whatever CD flow should so pseudo, which is something very important. 376 00:22:57,480 --> 00:22:58,250 We will talk about it. 377 00:22:58,260 --> 00:23:00,320 Don't worry about things. 378 00:23:00,330 --> 00:23:04,320 OK, now until we have another commands, which is the groups. 379 00:23:04,320 --> 00:23:06,690 So you can see that we have the groups like this. 380 00:23:06,930 --> 00:23:12,970 So you can see it will bring not only the groups that user or the current user, which is open to it. 381 00:23:13,010 --> 00:23:17,850 My guess is in which is open to at the end and oh Khedive lobby. 382 00:23:17,860 --> 00:23:21,180 So the pseudo audio blah blah blah, whatever. 383 00:23:21,210 --> 00:23:22,230 OK, all right. 384 00:23:22,240 --> 00:23:22,970 So far so good. 385 00:23:23,230 --> 00:23:26,220 Now one last thing I want to mention here in this lecture. 386 00:23:26,340 --> 00:23:32,910 I know the lecture took too long time, but actually these are the most important things in in the 9x, 387 00:23:32,910 --> 00:23:36,970 which is the permission when the most important one of the most important or. 388 00:23:36,970 --> 00:23:37,310 Right. 389 00:23:37,800 --> 00:23:39,780 So which is the special permission. 390 00:23:39,870 --> 00:23:45,930 OK, so let's clear this came first and as now for the special permission, actually. 391 00:23:46,860 --> 00:23:54,450 We have three special permissions, the ASU idea or visit your user ID, that idea, which is the city 392 00:23:54,690 --> 00:24:01,530 guide, and we have the sticky bit, which is the sticky bit for the directress only. 393 00:24:02,380 --> 00:24:03,290 Now, let's have a look. 394 00:24:03,490 --> 00:24:11,230 Don't worry, we have that indicates now the first thing actually how to implement or how to apply these 395 00:24:11,280 --> 00:24:15,450 permissions actually using something we already use, which is the statement. 396 00:24:15,790 --> 00:24:16,150 Yeah. 397 00:24:16,390 --> 00:24:18,540 And you need them for this point, which is the text. 398 00:24:18,910 --> 00:24:22,070 And we need to move forward for user or group or other. 399 00:24:22,150 --> 00:24:23,520 Let's use them for all. 400 00:24:23,710 --> 00:24:29,650 So all equal or less but less which means increase that. 401 00:24:29,770 --> 00:24:31,690 OK, we already learned that. 402 00:24:31,690 --> 00:24:35,390 I'm assuming that you are familiar now with the sigmoid command. 403 00:24:35,780 --> 00:24:43,030 Now this time I will not use, read or write or execute this type of use special that are called s either 404 00:24:43,030 --> 00:24:44,620 small or small. 405 00:24:45,040 --> 00:24:52,600 Now as it starts with the S first, then we will go that don't worry the S which means the special permission. 406 00:24:53,700 --> 00:25:05,790 OK, which means the special permission for that they're sold or that that group ID, so I guess as 407 00:25:06,060 --> 00:25:11,130 to the Teda text, now you can see that we have them here if I type it. 408 00:25:11,150 --> 00:25:18,660 Yeah, you can see that it is now red highlighted in red and you can see that there are us, not Ardebili. 409 00:25:18,660 --> 00:25:23,690 It's you can see previously it was Ardipithecus and now it is right there with us. 410 00:25:23,910 --> 00:25:25,410 And again it is red. 411 00:25:25,410 --> 00:25:25,650 Right. 412 00:25:25,650 --> 00:25:28,320 Execute for the group and here it is red. 413 00:25:28,320 --> 00:25:30,060 Right s which means suspicion. 414 00:25:30,500 --> 00:25:33,850 Right now you can see that it is small while it is small. 415 00:25:34,020 --> 00:25:39,510 What is the difference between the small and the capital now that small, which means the execute bit 416 00:25:39,660 --> 00:25:45,960 is set, which means that this group is executable and it has the special permission. 417 00:25:46,170 --> 00:25:46,580 OK. 418 00:25:47,580 --> 00:25:54,180 And here, the same thing for the user, which means that special permission is set and it has the executable 419 00:25:54,900 --> 00:25:56,160 enabled for the owner. 420 00:25:56,760 --> 00:25:59,970 Now, what are actually actually what are that special permissions? 421 00:26:00,880 --> 00:26:07,690 Now, to be honest, the special commission is as simple as that, it is just run this fight and actually 422 00:26:07,900 --> 00:26:13,400 it's better to have an executable fight, to be honest, not for a regular phone or I think it's fine 423 00:26:13,450 --> 00:26:14,400 just to read or write. 424 00:26:14,440 --> 00:26:17,440 No, actually, these are worked, actually. 425 00:26:17,440 --> 00:26:24,280 Exactly that you case for the executables fights, either executable files or executable entries. 426 00:26:24,460 --> 00:26:26,740 So executable fights in my case. 427 00:26:26,900 --> 00:26:29,860 Let's imagine I have a bash script here or Python. 428 00:26:30,190 --> 00:26:36,290 So which means run this fight as the owner, which means as that privilege of the owner. 429 00:26:36,310 --> 00:26:41,890 So imagine if this is a road owner and run this fight as a as the owner, which means I'm in this fight 430 00:26:41,890 --> 00:26:46,060 as a rule, which means this is a very huge security breach. 431 00:26:46,060 --> 00:26:51,490 Or in the other hand, it is something you already used for this purpose. 432 00:26:51,520 --> 00:26:55,300 OK, so you need to be careful here because this is something dangerous. 433 00:26:55,390 --> 00:26:59,030 If the owner is right, you need to be careful here. 434 00:26:59,090 --> 00:27:06,430 OK, so cat, so this means that anyone can execute this as the root, which means it has the privilege 435 00:27:06,430 --> 00:27:11,380 of executing what commands, which means you compromised the whole system, which is something very 436 00:27:11,380 --> 00:27:11,850 dangerous. 437 00:27:12,310 --> 00:27:14,080 Now for the group, it is the same. 438 00:27:14,080 --> 00:27:21,880 You can see that we have it here and which means run this fight the executive and let's imagine it is 439 00:27:21,880 --> 00:27:22,630 a bad script. 440 00:27:22,630 --> 00:27:30,990 OK, run this script and that group owner, which is not the owner only or as a group. 441 00:27:31,120 --> 00:27:35,070 So which means that it will run first as owner and it will run as a group as well. 442 00:27:35,270 --> 00:27:35,560 OK. 443 00:27:36,070 --> 00:27:37,930 By the way, there are precedents here. 444 00:27:37,930 --> 00:27:42,950 The first precedent for the owner, then the group, then we have the other. 445 00:27:43,050 --> 00:27:49,810 OK, now you can see that on that other part or the other executable here. 446 00:27:49,810 --> 00:27:57,160 It is not right now, but before that, let's put the same command which is er plus s but this time 447 00:27:57,160 --> 00:27:59,560 I would what s capitán which is as this. 448 00:28:00,130 --> 00:28:06,470 You can see that er give me a ok now if I blis minus it will give me your. 449 00:28:06,520 --> 00:28:12,340 OK, so how to do that which is minus X minus from T from everyone. 450 00:28:12,460 --> 00:28:20,350 If I type it like this, if I type S dash and this time you can see that now it is s capital not as 451 00:28:20,350 --> 00:28:29,590 small which means the executable bit under it or inside it is set to off, which means it is Desh like 452 00:28:29,590 --> 00:28:30,910 this here. 453 00:28:31,300 --> 00:28:37,240 But previously you can see that it is a small but now it is Surbiton which means X capital. 454 00:28:37,390 --> 00:28:46,360 The executable for the group or the owner is to know or sit to an all or no executable which are enabled. 455 00:28:47,050 --> 00:28:52,020 Now the last thing let's talk about the sticky bit and actually this is only work on the directress. 456 00:28:52,300 --> 00:29:02,560 OK, so how to do that sigmoid er assume it's er plus now this that I would not use this time I would 457 00:29:02,560 --> 00:29:09,580 use t by the way a T capital would not work as this as well here inside this excitement. 458 00:29:09,910 --> 00:29:13,900 So you need to remove the executable bit from it. 459 00:29:13,930 --> 00:29:21,250 OK, so let's add that sticky bit sticky bit for the Dir one and let's have a look here. 460 00:29:22,640 --> 00:29:25,740 Oh, cool, so you can see that now it has. 461 00:29:25,790 --> 00:29:32,780 And by the way, it is the capital, as we mentioned previously in this case here, as you can see, 462 00:29:32,960 --> 00:29:39,140 which means that the executable bit is set to zero or none, which means that no executable with you. 463 00:29:39,450 --> 00:29:48,380 OK, now if I type at mode, let's say other plus executable and we want for it for the one. 464 00:29:48,830 --> 00:29:50,480 And let's have an additional. 465 00:29:50,600 --> 00:29:53,060 You can see that it is not capital this time. 466 00:29:53,180 --> 00:29:55,330 It is too small, by the way. 467 00:29:56,850 --> 00:29:57,630 And again. 468 00:29:58,690 --> 00:30:02,860 What are the sticky bit we already learned, what are that? 469 00:30:03,460 --> 00:30:10,150 And as you ideologized, which is for the user or the group and actually these are for the directory, 470 00:30:10,150 --> 00:30:13,450 for the regular part, actually, for the security, but fine as well. 471 00:30:14,140 --> 00:30:16,930 But for the sticky bit, it is only for directress. 472 00:30:17,110 --> 00:30:24,760 And this means that only the root user, which is the user or the owner of the fight, can remove this 473 00:30:24,760 --> 00:30:26,310 fight or this directory. 474 00:30:26,320 --> 00:30:30,720 Actually, this is only work for the victims where it is. 475 00:30:30,790 --> 00:30:35,040 That is the system you can see if you go to the temp directory. 476 00:30:35,530 --> 00:30:42,340 So actually it is clear the screen and SSL for the temp directory, you can see that we have it here. 477 00:30:43,350 --> 00:30:52,290 So you can see that I need for the temp directory itself, so if I type it like this, actually you 478 00:30:52,290 --> 00:30:58,450 can see that it has the T machine, which is the sticky bit, and it is executable because it is pretty 479 00:30:58,470 --> 00:30:58,770 small. 480 00:30:58,950 --> 00:31:06,780 OK, so this means that only the root or the file owner on this directory, which is let's have a look 481 00:31:06,780 --> 00:31:06,990 here. 482 00:31:06,990 --> 00:31:08,070 Actually, it's good. 483 00:31:09,160 --> 00:31:14,550 So which means, for example, this fight only the matter user for this fight, only the wealthy. 484 00:31:14,590 --> 00:31:16,870 By the way, it is the road only for this fight. 485 00:31:16,870 --> 00:31:24,430 Only the Ubuntu user can remove this directory or does that of t only the matter can remove this directory 486 00:31:24,430 --> 00:31:25,690 ordered, by the way. 487 00:31:26,140 --> 00:31:28,690 And here the same thing for that one to matter. 488 00:31:29,500 --> 00:31:31,920 OK, so this is what sticky bittar. 489 00:31:37,100 --> 00:31:41,750 Sorry for the long lecture, but actually it is very important, if you didn't understand, you can 490 00:31:41,750 --> 00:31:47,410 ask me a question or you can read that theory, but again, you will understand everything there. 491 00:31:47,690 --> 00:31:48,490 Thanks for watching. 492 00:31:48,500 --> 00:31:49,660 I will see you in the next lecture.