1
00:00:01,350 --> 00:00:04,470
Hello, everyone, and welcome to this video.

2
00:00:04,710 --> 00:00:09,630
So in this video, we are going to learn about Linux permissions.

3
00:00:09,810 --> 00:00:12,420
Linux permissions are very, very important.

4
00:00:12,420 --> 00:00:21,540
And every one of you should know how these permissions work and how to implement these types of permissions.

5
00:00:21,660 --> 00:00:23,160
So let's quickly begin.

6
00:00:23,400 --> 00:00:33,960
So in Linux, there are three types of permissions that we are going to give to any file or any directories.

7
00:00:34,110 --> 00:00:42,360
Now, these three permissions are the first one is read, which is denoted by a symbol which is R.

8
00:00:42,600 --> 00:00:46,890
The second one is right, which is denoted by W.

9
00:00:47,250 --> 00:00:52,090
And the third one is execute, which is denoted by X.

10
00:00:52,110 --> 00:00:53,850
It is not denoted by E.

11
00:00:53,880 --> 00:00:55,290
It is denoted by X.

12
00:00:55,650 --> 00:01:02,020
So here we know that we have three permissions read, write and execute X.

13
00:01:02,040 --> 00:01:02,700
All right.

14
00:01:02,700 --> 00:01:09,390
So in Linux now, there are three people to whom do we give permissions?

15
00:01:09,720 --> 00:01:12,390
Those are the first one is a user.

16
00:01:12,960 --> 00:01:15,060
The second one is a group.

17
00:01:15,060 --> 00:01:17,130
So user is denoted by you.

18
00:01:17,340 --> 00:01:23,700
The group is denoted by G and others, which is denoted by O.

19
00:01:23,880 --> 00:01:27,660
So a user is someone who has created a file.

20
00:01:27,870 --> 00:01:39,030
The group is for a specific list of users who are in a group and all those people who are not the user,

21
00:01:39,300 --> 00:01:44,340
who have not created the file or the people who are not into a specific group.

22
00:01:44,430 --> 00:01:51,630
For example, let's say there is an organization and all the sales people are already added into a group

23
00:01:51,630 --> 00:01:52,810
which is sales group.

24
00:01:52,830 --> 00:01:59,310
Now those who get added into this group get specific set of permissions.

25
00:01:59,580 --> 00:02:02,160
Those are considered to be a group.

26
00:02:02,790 --> 00:02:04,020
Now, who are others?

27
00:02:04,050 --> 00:02:07,930
Others are who fall out of this category.

28
00:02:07,950 --> 00:02:13,770
They are not into the group, which is the sales group, for example, or those are not the people who

29
00:02:13,770 --> 00:02:16,890
have created the file, which means they are also not the users.

30
00:02:17,340 --> 00:02:20,880
Apart from these people, everyone else is others.

31
00:02:21,360 --> 00:02:24,330
So I hope you guys understood who is others.

32
00:02:24,780 --> 00:02:25,470
Perfect.

33
00:02:25,680 --> 00:02:32,850
So now we need to give permission to these three people user which is denoted by you group which is

34
00:02:32,850 --> 00:02:36,840
denoted by G and others who is denoted by O.

35
00:02:38,840 --> 00:02:39,680
In Linux.

36
00:02:39,680 --> 00:02:46,580
You should know one thing that the permissions are denoted this way for any file or any directory,

37
00:02:46,670 --> 00:02:54,200
which is read, write, execute, hyphen, read, write, execute, hyphen, read, write, execute.

38
00:02:54,440 --> 00:03:03,620
The first block is for the user, the second block is for the group, and the third block is for others.

39
00:03:03,770 --> 00:03:10,730
So this is how the permissions are given to user group and others.

40
00:03:11,820 --> 00:03:20,520
Now in the first block, if it is written as r w x, that automatically means that user has got the

41
00:03:20,520 --> 00:03:25,530
read, write and execute permission, which means the user has all the permissions.

42
00:03:25,560 --> 00:03:33,030
Similarly, the group also have read, write, execute, which means it also has all the permissions.

43
00:03:33,210 --> 00:03:40,020
Similarly, others have RW X, which means it also has all the permissions.

44
00:03:40,020 --> 00:03:40,740
Perfect.

45
00:03:41,040 --> 00:03:50,340
Now let's go to our terminal and let's try to see the permissions for the file, which is X, Y, Z.

46
00:03:50,850 --> 00:03:58,110
Now here the command to see the permission is ls hyphen all through which we are getting the detailed

47
00:03:58,110 --> 00:04:03,060
information of a file which we have created, and the file name is x, y, z.

48
00:04:03,540 --> 00:04:12,630
Here you can notice the permissions that are being given is RW hyphen, ah, hyphen, hyphen, ah,

49
00:04:12,840 --> 00:04:13,830
dash, dash.

50
00:04:13,860 --> 00:04:19,980
Now here you should understand the first block is for user.

51
00:04:20,010 --> 00:04:23,040
The second block is for the group.

52
00:04:23,070 --> 00:04:27,900
Third block is for others, as we have learned until now.

53
00:04:28,020 --> 00:04:34,050
So this automatically means that the user has read and write permission.

54
00:04:34,320 --> 00:04:36,750
The group has read permission.

55
00:04:36,750 --> 00:04:42,750
They cannot write, and others have only and only read permission.

56
00:04:43,630 --> 00:04:43,930
Okay.

57
00:04:43,980 --> 00:04:45,570
So here we know that.

58
00:04:45,570 --> 00:04:47,730
What are the permissions that have been given?

59
00:04:47,760 --> 00:04:51,820
Remember, there is no execute permission given to anyone.

60
00:04:51,840 --> 00:04:53,510
Now what is execute?

61
00:04:53,520 --> 00:04:54,570
You may ask.

62
00:04:54,570 --> 00:05:03,810
So in case there are any scripts that need to be executed then and only then, we need to give them

63
00:05:03,810 --> 00:05:10,450
the permissions of execution or else they will not run or will not get executed.

64
00:05:10,470 --> 00:05:11,160
Perfect.

65
00:05:12,260 --> 00:05:16,220
So let's quickly see the user has the read write permission.

66
00:05:16,220 --> 00:05:20,780
So let's see who is the user currently and the user is root.

67
00:05:20,780 --> 00:05:29,120
And we also know that in the detail of this file, which is X, Y, Z, the user who has created this

68
00:05:29,120 --> 00:05:33,260
file is root and the group is also root perfect.

69
00:05:33,260 --> 00:05:41,030
So now we know that the user is able to read as well as write the file and the user is root itself.

70
00:05:41,270 --> 00:05:49,010
So let's quickly try and see if the user can read it by the command, which is Cat X, Y, Z, and yes,

71
00:05:49,010 --> 00:05:52,460
the user can read the file because the permission is given.

72
00:05:52,610 --> 00:05:58,700
Now let's try if the user can write as well because the permission is given off.

73
00:05:58,700 --> 00:06:03,680
W So let's quickly write into this file using the command nano.

74
00:06:03,680 --> 00:06:09,590
So nano x, y, z and here we can see we are inside the file and we are modifying it.

75
00:06:09,590 --> 00:06:15,320
So let's quickly write something which is this is modified now let's try to save this.

76
00:06:15,320 --> 00:06:22,940
We have saved it and let's try to read it now and see if our changes reflect over there or no.

77
00:06:23,360 --> 00:06:30,260
And here you can see we have successfully modified the file, which means the permissions that are given

78
00:06:30,260 --> 00:06:31,490
are correct.

79
00:06:31,940 --> 00:06:40,820
Now the group has the permission of read, which means anyone who is into the group root can read this

80
00:06:40,880 --> 00:06:49,580
file and let's see the last permission, which is our which is only read, which means others who are

81
00:06:49,580 --> 00:06:56,930
not the user root and who are not into the group root are others.

82
00:06:57,530 --> 00:07:01,100
So let's quickly try to add a user.

83
00:07:01,100 --> 00:07:08,600
So for that we are going to use a command which is user read and let's make a user named Udemy and let's

84
00:07:08,600 --> 00:07:15,500
also give a password for that user, which is Udemy and I have set the password for this user.

85
00:07:15,530 --> 00:07:21,500
Let's quickly switch the user by the command issue and now we have switched the user.

86
00:07:21,500 --> 00:07:23,540
So now we are Udemy.

87
00:07:23,990 --> 00:07:31,730
So let's try to read this file and you have seen through the permission that yes, others get the read

88
00:07:31,730 --> 00:07:32,360
permission.

89
00:07:32,360 --> 00:07:35,600
So that is the reason we are able to read the file.

90
00:07:35,810 --> 00:07:45,410
Now this user is going to try to write the file, which is the W permission and we have seen that the

91
00:07:45,410 --> 00:07:52,610
user does not have the right permission and still he tries to write the file using the command nano.

92
00:07:53,210 --> 00:08:01,280
And here you can see at the first place there is an error which says the file x, y, z is unreadable,

93
00:08:01,280 --> 00:08:08,030
but the user still tries to write and he writes modified by Udemy and tries to save the file.

94
00:08:08,030 --> 00:08:16,820
And it gives an error which is permission denied, which means others, which is the Udemy user, cannot

95
00:08:16,820 --> 00:08:22,250
make changes to file because he does not have the right permissions.

96
00:08:22,640 --> 00:08:28,790
So let's quickly switch back to the main user, which is the root user who has made the file.

97
00:08:28,790 --> 00:08:34,490
And let's see if there are the changes that are being done by the Udemy user or no.

98
00:08:34,490 --> 00:08:42,170
And here we can see there are no changes then, because for obvious reasons Udemy did not have the right

99
00:08:42,170 --> 00:08:48,380
permissions to write into the file X, Y, Z, as we have seen into the permissions.

100
00:08:49,010 --> 00:08:56,060
So I hope you guys understood what are Linux permissions, how it is given and how we have to understand

101
00:08:56,060 --> 00:09:02,060
these permissions in case you have any doubts or queries you can ask into the Q&amp;A section.

102
00:09:02,060 --> 00:09:02,780
Thank you.
