WEBVTT - This file was automatically generated by VIMEO

0
00:00:14.800 --> 00:00:17.200
Hello everyone and welcome to this

1
00:00:17.200 --> 00:00:17.600
 video.

2
00:00:18.400 --> 00:00:22.800
So in this video we are going to learn about Linux permissions

3
00:00:22.800 --> 00:00:25.500
 Linux permissions are very very important

4
00:00:25.500 --> 00:00:28.700
 and every one of you should know how these

5
00:00:28.700 --> 00:00:30.000
 permissions work.

6
00:00:30.900 --> 00:00:33.700
And how to implement these types

7
00:00:33.700 --> 00:00:37.100
 of permissions, so let's quickly begin. So

8
00:00:37.900 --> 00:00:40.700
In Linux, there are three types

9
00:00:40.700 --> 00:00:43.200
 of permissions that we are

10
00:00:43.200 --> 00:00:47.200
 going to give to any file or any directories.

11
00:00:46.200 --> 00:00:49.800
 Now these three permissions

12
00:00:49.800 --> 00:00:53.000
 are the first one is read which

13
00:00:52.100 --> 00:00:55.500
 is denoted by a symbol which is R.

14
00:00:55.500 --> 00:00:58.300
 The second one is right, which is

15
00:00:58.300 --> 00:01:00.000
 denoted by w.

16
00:01:00.800 --> 00:01:03.400
And the third one is execute which is

17
00:01:03.400 --> 00:01:06.000
 denoted by X. It is not

18
00:01:06.800 --> 00:01:09.800
 denoted by E. It is denoted by X. So here

19
00:01:09.800 --> 00:01:13.000
 we know that we have three permissions read write

20
00:01:12.400 --> 00:01:15.900
 and execute X. All

21
00:01:15.900 --> 00:01:18.300
 right. So in Linux now, there are

22
00:01:18.300 --> 00:01:21.400
 three people to whom do

23
00:01:21.400 --> 00:01:22.500
 we give permissions?

24
00:01:23.200 --> 00:01:25.700
Those are the first one is a user.

25
00:01:26.400 --> 00:01:29.600
The second one is a group so user is

26
00:01:29.600 --> 00:01:32.600
 denoted by you. The group is denoted by

27
00:01:32.600 --> 00:01:35.600
 G and others which is

28
00:01:35.600 --> 00:01:38.300
 denoted by O So a user

29
00:01:38.300 --> 00:01:41.900
 is someone who has created a file the group

30
00:01:41.900 --> 00:01:44.600
 is for a specific list

31
00:01:44.600 --> 00:01:47.100
 of users who are in a group.

32
00:01:48.200 --> 00:01:51.800
And all those people who are not the

33
00:01:51.800 --> 00:01:52.200
 user.

34
00:01:52.900 --> 00:01:55.200
Who have not created the file or the people

35
00:01:55.200 --> 00:01:58.500
 who are not into a specific group. For example,

36
00:01:58.500 --> 00:02:01.400
 let's say there is an organization and all

37
00:02:01.400 --> 00:02:04.600
 the sales people are already added into

38
00:02:04.600 --> 00:02:07.700
 a group which is Sales Group. Now those who

39
00:02:07.700 --> 00:02:11.000
 get added into this group get specific

40
00:02:10.500 --> 00:02:13.800
 set of permissions. Those are

41
00:02:13.800 --> 00:02:15.200
 considered to be a group.

42
00:02:16.300 --> 00:02:20.000
Now who are others others are who fall out

43
00:02:19.200 --> 00:02:22.500
 of this category? They are not into

44
00:02:22.500 --> 00:02:26.100
 the group which is the sales group. For example, or those

45
00:02:25.100 --> 00:02:28.500
 are not the people who have created the file, which

46
00:02:28.500 --> 00:02:30.200
 means they are also not the users.

47
00:02:30.800 --> 00:02:33.500
Apart from these people everyone else is

48
00:02:33.500 --> 00:02:34.100
 others.

49
00:02:34.900 --> 00:02:37.600
So I hope you guys understood who is others.

50
00:02:38.200 --> 00:02:38.600
Perfect.

51
00:02:39.300 --> 00:02:42.400
So now we need to give permission to these three people

52
00:02:42.400 --> 00:02:46.200
 user which is denoted by you group, which

53
00:02:45.200 --> 00:02:48.800
 is denoted by G and others who

54
00:02:48.800 --> 00:02:50.200
 is denoted by o

55
00:02:52.300 --> 00:02:55.700
In Linux, you should know one thing that the permissions

56
00:02:55.700 --> 00:02:58.400
 are denoted this way for any file

57
00:02:58.400 --> 00:03:01.700
 or any directory, which is read right

58
00:03:01.700 --> 00:03:04.300
 execute hyphen. Read write

59
00:03:04.300 --> 00:03:08.200
 execute hyphen read write execute. The

60
00:03:07.200 --> 00:03:10.300
 first block is for the

61
00:03:10.300 --> 00:03:10.800
 user.

62
00:03:11.500 --> 00:03:14.900
The second block is for the group and the

63
00:03:14.900 --> 00:03:17.800
 third block is for others. So this

64
00:03:17.800 --> 00:03:20.900
 is how the permissions are given

65
00:03:20.900 --> 00:03:24.000
 to user group and others.

66
00:03:25.300 --> 00:03:28.100
now in the first block if it is

67
00:03:28.100 --> 00:03:31.900
 written as r w x that automatically means

68
00:03:31.900 --> 00:03:34.300
 that user has got the read

69
00:03:34.300 --> 00:03:37.500
 right and execute permission, which means the user

70
00:03:37.500 --> 00:03:40.500
 has all the permissions similarly the group

71
00:03:40.500 --> 00:03:43.600
 also have read write execute

72
00:03:43.600 --> 00:03:46.100
 which means it also has all the permissions

73
00:03:46.900 --> 00:03:49.800
Similarly, others have rwx which

74
00:03:49.800 --> 00:03:52.700
 means it also has all the

75
00:03:52.700 --> 00:03:56.000
 permissions perfect. Now, let's go

76
00:03:55.200 --> 00:03:57.500
 to our terminal.

77
00:03:58.300 --> 00:04:01.300
And let's try to see the permissions for

78
00:04:01.300 --> 00:04:03.700
 the file, which is X Y Z.

79
00:04:04.400 --> 00:04:07.800
now here the command to see the permission is LS

80
00:04:07.800 --> 00:04:10.200
 hyphen all through which we

81
00:04:10.200 --> 00:04:13.300
 are getting the detailed information of a file

82
00:04:13.300 --> 00:04:16.400
 which we have created and the file name is X Y Z

83
00:04:17.200 --> 00:04:20.600
Here you can notice the permissions that are being

84
00:04:20.600 --> 00:04:21.000
 given is.

85
00:04:21.900 --> 00:04:25.100
R. W hyphen are hyphen

86
00:04:24.100 --> 00:04:27.200
 hyphen R dash dash

87
00:04:27.200 --> 00:04:30.400
 now here. You should understand the first

88
00:04:30.400 --> 00:04:30.900
 block.

89
00:04:31.800 --> 00:04:34.500
Is for user the second block

90
00:04:34.500 --> 00:04:37.700
 is for the group third block is

91
00:04:37.700 --> 00:04:40.900
 for others as we have learned till

92
00:04:40.900 --> 00:04:43.500
 now. So this automatically means

93
00:04:43.500 --> 00:04:46.500
 that the user has read and write

94
00:04:46.500 --> 00:04:50.000
 permission. The group has read permission.

95
00:04:49.300 --> 00:04:53.000
 They cannot write and others

96
00:04:52.400 --> 00:04:56.000
 have only an only read permission.

97
00:04:56.900 --> 00:04:59.500
Okay, so here we know that what are

98
00:04:59.500 --> 00:05:02.200
 the permissions that have been given remember there is

99
00:05:02.200 --> 00:05:05.600
 no execute permission given to anyone. Now.

100
00:05:05.600 --> 00:05:08.800
 What is execute you may ask? So in

101
00:05:08.800 --> 00:05:11.800
 case there are any scripts that need

102
00:05:11.800 --> 00:05:14.500
 to be executed then and

103
00:05:14.500 --> 00:05:17.300
 only then we need to give them the

104
00:05:17.300 --> 00:05:20.600
 permissions of execution or else they

105
00:05:20.600 --> 00:05:24.300
 will not run or will not get executed. Perfect.

106
00:05:25.800 --> 00:05:28.300
So let's quickly see the user has

107
00:05:28.300 --> 00:05:31.200
 the read/write permission. So let's see who is

108
00:05:31.200 --> 00:05:34.600
 the user currently and the user is root. And

109
00:05:34.600 --> 00:05:37.100
 we also know that in the

110
00:05:37.100 --> 00:05:40.700
 detail of this file, which is x y z the

111
00:05:40.700 --> 00:05:43.600
 user who has created this file is root

112
00:05:43.600 --> 00:05:47.000
 and the group is also root perfect. So

113
00:05:46.200 --> 00:05:49.500
 now we know that the user is

114
00:05:49.500 --> 00:05:52.200
 able to read as well as write the file

115
00:05:52.200 --> 00:05:55.100
 and the user is root itself. So let's

116
00:05:55.100 --> 00:05:57.600
 quickly try and see if the user can read it.

117
00:05:58.700 --> 00:06:01.700
By the command which is cat XYZ and

118
00:06:01.700 --> 00:06:04.600
 yes, the user can read the file because

119
00:06:04.600 --> 00:06:07.400
 the permission is given now let's try

120
00:06:07.400 --> 00:06:10.400
 if the user can write as well because

121
00:06:10.400 --> 00:06:13.700
 the permission is given of w, so, let's

122
00:06:13.700 --> 00:06:17.000
 quickly write into this file using the command Nano.

123
00:06:16.400 --> 00:06:19.200
 So Nano XYZ and here

124
00:06:19.200 --> 00:06:22.600
 we can see we are inside the file and we have modifying

125
00:06:22.600 --> 00:06:25.400
 it. So let's quickly write something which is this

126
00:06:25.400 --> 00:06:28.200
 is modified. Now, let's try to

127
00:06:28.200 --> 00:06:31.800
 save this. We have saved it and let's try

128
00:06:31.800 --> 00:06:35.200
 to read it now and see if our changes reflect

129
00:06:34.200 --> 00:06:36.300
 over there or no.

130
00:06:36.900 --> 00:06:40.500
And here you can see we have successfully modified

131
00:06:39.500 --> 00:06:42.300
 the file which means the

132
00:06:42.300 --> 00:06:44.700
 permissions that are given are correct.

133
00:06:45.400 --> 00:06:48.900
Now the group has the permission of read

134
00:06:48.900 --> 00:06:51.200
 which means anyone who

135
00:06:51.200 --> 00:06:54.800
 is into the group root can read this file.

136
00:06:54.800 --> 00:06:57.600
 And let's see the last permission which

137
00:06:57.600 --> 00:07:00.900
 is R which is only read which

138
00:07:00.900 --> 00:07:03.600
 means others who are not the

139
00:07:03.600 --> 00:07:05.000
 user root.

140
00:07:05.800 --> 00:07:09.000
And who are not into the group root

141
00:07:08.700 --> 00:07:10.200
 or others?

142
00:07:11.200 --> 00:07:14.400
So let's quickly try to add a user

143
00:07:14.400 --> 00:07:17.400
 so for that we are going to use a command which

144
00:07:17.400 --> 00:07:20.300
 is user ad and let's make a user named

145
00:07:20.300 --> 00:07:23.500
 urumi and let's also give a password for

146
00:07:23.500 --> 00:07:26.200
 that user which is udemy and I have set

147
00:07:26.200 --> 00:07:26.800
 at the password.

148
00:07:27.900 --> 00:07:30.500
For this user let's quickly switch the user

149
00:07:30.500 --> 00:07:33.400
 by the command Su and now

150
00:07:33.400 --> 00:07:37.000
 we have switched the user. So now we are udemy.

151
00:07:37.600 --> 00:07:40.500
So let's try to read this file and you have

152
00:07:40.500 --> 00:07:44.500
 seen through the permission that yes others

153
00:07:43.500 --> 00:07:46.600
 get the read permission. So that

154
00:07:46.600 --> 00:07:50.800
 is the reason we are able to read the file. Now. This

155
00:07:49.800 --> 00:07:52.700
 user is going to

156
00:07:52.700 --> 00:07:55.400
 try to write the file, which is

157
00:07:55.400 --> 00:07:58.700
 the W permission and we have seen that

158
00:07:58.700 --> 00:08:02.000
 the user does not have the right permission and

159
00:08:01.300 --> 00:08:04.700
 still he tries to write the file using the

160
00:08:04.700 --> 00:08:06.100
 command Nano.

161
00:08:06.600 --> 00:08:10.000
And here you can see at the first place. There is

162
00:08:09.500 --> 00:08:13.500
 a error which says the file XYZ is

163
00:08:13.500 --> 00:08:16.100
 unwritable, but the user still

164
00:08:16.100 --> 00:08:19.200
 tries to write and he writes Modified by

165
00:08:19.600 --> 00:08:22.200
 udb and tries to save the file and it gives

166
00:08:22.200 --> 00:08:25.700
 a error which is permission denied. Which

167
00:08:25.700 --> 00:08:25.900
 means

168
00:08:26.900 --> 00:08:29.500
Others which is the udemy user

169
00:08:29.500 --> 00:08:32.800
 cannot make changes to file because he

170
00:08:32.800 --> 00:08:35.500
 does not have the right permissions.

171
00:08:36.200 --> 00:08:39.200
So let's quickly switch back to the main user which

172
00:08:39.200 --> 00:08:42.500
 is the root user who has made the file and

173
00:08:42.500 --> 00:08:45.500
 let's see if there are the changes that have

174
00:08:45.500 --> 00:08:48.500
 been done by the udemy user or no and here

175
00:08:48.500 --> 00:08:51.400
 we can see there are no changes done because for

176
00:08:51.400 --> 00:08:54.600
 obvious reasons udemy did not

177
00:08:54.600 --> 00:08:57.500
 have the right permissions to write into

178
00:08:57.500 --> 00:09:00.900
 the file XYZ as we have seen into

179
00:09:00.900 --> 00:09:01.600
 the permissions.

180
00:09:02.600 --> 00:09:05.600
So I hope you guys understood what are Linux permissions

181
00:09:05.600 --> 00:09:08.600
 how it is given and how we have

182
00:09:08.600 --> 00:09:10.400
 to understand this permissions.

183
00:09:11.100 --> 00:09:14.400
In case you have any doubts or queries, you can ask into

184
00:09:14.400 --> 00:09:15.900
 the Q&A section. Thank you.
