1 00:00:06,450 --> 00:00:08,850 - In this video, I will tell you about permissions 2 00:00:08,850 --> 00:00:10,740 the basic permissions in Linux. 3 00:00:10,740 --> 00:00:12,030 There's three of them. 4 00:00:12,030 --> 00:00:17,030 We have read, we have write, and we have execute. 5 00:00:20,220 --> 00:00:23,370 Now, when you are going to assign these permissions 6 00:00:23,370 --> 00:00:26,280 using the chmod command, 7 00:00:26,280 --> 00:00:30,960 you are probably going to use what we call the octal mode. 8 00:00:30,960 --> 00:00:32,070 That's a number 9 00:00:32,070 --> 00:00:36,153 and you are going to assign these numbers to ugo, 10 00:00:36,153 --> 00:00:37,800 ugo, user, groups and others. 11 00:00:37,800 --> 00:00:39,480 I'll tell you more about it later, 12 00:00:39,480 --> 00:00:42,870 but I already want to give you the number. 13 00:00:42,870 --> 00:00:47,870 Read is four, write is two, and execute is one. 14 00:00:49,680 --> 00:00:51,600 Now, while assigning these permissions, 15 00:00:51,600 --> 00:00:53,940 it is essential to understand 16 00:00:53,940 --> 00:00:55,920 what these permissions are doing 17 00:00:55,920 --> 00:00:59,553 on files or on directories. 18 00:01:00,600 --> 00:01:05,040 Well, if you have read on a file, guess what you can do. 19 00:01:05,040 --> 00:01:09,423 You're right, that allows you to actually read the file. 20 00:01:10,500 --> 00:01:12,720 Read the file, in computer technology, 21 00:01:12,720 --> 00:01:14,850 means you can open the file in memory 22 00:01:14,850 --> 00:01:17,370 and do whatever you want to do with it. 23 00:01:17,370 --> 00:01:20,220 And how about read on a directory? 24 00:01:20,220 --> 00:01:22,050 Well, if you have read on the directory 25 00:01:22,050 --> 00:01:25,833 that means that you can list files in that directory. 26 00:01:27,030 --> 00:01:28,290 Now we have write. 27 00:01:28,290 --> 00:01:29,790 If you have write on files 28 00:01:29,790 --> 00:01:32,910 then you can actually modify your files. 29 00:01:32,910 --> 00:01:35,340 If you have write on the directory 30 00:01:35,340 --> 00:01:40,340 that allows you to add or delete files from that directory. 31 00:01:41,760 --> 00:01:43,590 And that is something that you should remember. 32 00:01:43,590 --> 00:01:46,410 Deleting files is a directory operation, 33 00:01:46,410 --> 00:01:49,260 not a file operation, so you don't need permissions 34 00:01:49,260 --> 00:01:50,910 on the file in order to delete it. 35 00:01:50,910 --> 00:01:52,380 You just need permissions 36 00:01:52,380 --> 00:01:55,141 on the directory that contains the file. 37 00:01:55,141 --> 00:01:56,130 And last, there is execute. 38 00:01:56,130 --> 00:01:59,220 Execute is a very important permission in Linux 39 00:01:59,220 --> 00:02:03,150 because that's the permission that makes Linux secure. 40 00:02:03,150 --> 00:02:06,600 Execute is what you need in order to run a command. 41 00:02:06,600 --> 00:02:08,490 If you don't have execute permissions 42 00:02:08,490 --> 00:02:10,200 you cannot run the file. 43 00:02:10,200 --> 00:02:13,230 That is what makes Linux a very secure operating system. 44 00:02:13,230 --> 00:02:15,780 And that's also the main reason why Linux, 45 00:02:15,780 --> 00:02:18,993 you don't need any antivirus or whatever, 46 00:02:20,730 --> 00:02:23,133 because execute doesn't come by default. 47 00:02:23,970 --> 00:02:25,860 There is also execute on directories, 48 00:02:25,860 --> 00:02:27,630 and that means that you can cd 49 00:02:27,630 --> 00:02:30,420 and change into the directory. 50 00:02:30,420 --> 00:02:32,430 Now, in order to work with permissions, 51 00:02:32,430 --> 00:02:35,940 you need to assign these permissions to the owner. 52 00:02:35,940 --> 00:02:38,040 Linux works with ugo, as I mentioned, 53 00:02:38,040 --> 00:02:39,840 user, group and others. 54 00:02:39,840 --> 00:02:42,990 User is the user who is owner, group is the group owner, 55 00:02:42,990 --> 00:02:45,390 and others, that is everybody else. 56 00:02:45,390 --> 00:02:47,613 And I will show you next how to do that. 57 00:02:49,350 --> 00:02:52,350 So let me summarize what we have just seen. 58 00:02:52,350 --> 00:02:54,390 Basic permissions is what it's all about 59 00:02:54,390 --> 00:02:56,430 and you can set basic permissions to files 60 00:02:56,430 --> 00:02:58,320 as well as directories. 61 00:02:58,320 --> 00:03:00,060 And there are three basic permissions. 62 00:03:00,060 --> 00:03:04,380 To start with, there is read, with the octal value four. 63 00:03:04,380 --> 00:03:06,420 And read, if you apply it on files, 64 00:03:06,420 --> 00:03:09,000 means that you can read the contents of a file 65 00:03:09,000 --> 00:03:11,280 and on directories, it means that you can list 66 00:03:11,280 --> 00:03:13,473 the contents of directories with ls. 67 00:03:14,520 --> 00:03:17,760 Just make sure to understand that read on directory 68 00:03:17,760 --> 00:03:20,970 does not mean that you can read any files in that directory, 69 00:03:20,970 --> 00:03:24,993 because that is decided by the individual file permissions. 70 00:03:26,700 --> 00:03:28,860 Next, there is write, write on files 71 00:03:28,860 --> 00:03:31,680 means that you can modify the contents of the file 72 00:03:31,680 --> 00:03:34,590 and write on the directory means 73 00:03:34,590 --> 00:03:38,520 that you can add and remove files from the directory. 74 00:03:38,520 --> 00:03:40,170 The thing to realize here is that 75 00:03:40,170 --> 00:03:43,050 deleting a file is a directory operation. 76 00:03:43,050 --> 00:03:45,060 So that means if you have write on the directory 77 00:03:45,060 --> 00:03:46,740 you can delete it 78 00:03:46,740 --> 00:03:49,830 no matter which permissions you've got on the file. 79 00:03:49,830 --> 00:03:51,180 Next, we have execute. 80 00:03:51,180 --> 00:03:53,940 Execute on files means that you run the file 81 00:03:53,940 --> 00:03:56,160 if it contains executable code. 82 00:03:56,160 --> 00:03:59,610 And if you have execute on the directory, then it means 83 00:03:59,610 --> 00:04:03,780 that you can change into the directory using the cd command. 84 00:04:03,780 --> 00:04:04,613 That's all. 85 00:04:04,613 --> 00:04:07,083 In the next video, I will show you how to apply these.