YouTube2Text

Linux Commands for Beginners 21 - Changing Permissions Numerically — Transcript

by Learn Linux TV · 1,681 words · 224 segments · language en · Watch on YouTube

Full transcript

  1. 0:00[Music]
  2. 0:21hello again everyone in today's video we
  3. 0:24are going to revisit permissions we've
  4. 0:26already gone over permissions in video
  5. 0:28number 9 so if you haven't already seen
  6. 0:30video 9 I highly suggest that you watch
  7. 0:33that one first because in this video I'm
  8. 0:36going to show you how to understand the
  9. 0:38numerical value of permissions and in
  10. 0:42video number 9 we took a introduction
  11. 0:44look at permission so we're going to get
  12. 0:46a little bit more advanced in this video
  13. 0:49it's not too bad though so in this video
  14. 0:51you'll understand the numerical value of
  15. 0:53permissions and that's definitely an
  16. 0:55important thing to know so let's go
  17. 0:57ahead and dive right in so here are my
  18. 0:59terminal I have a brand new Ubuntu
  19. 1:03instance I created on Linode because I
  20. 1:05wanted a clean instance for the purposes
  21. 1:08of this video I didn't want to change
  22. 1:10permissions on my actual files and
  23. 1:12folders but it doesn't really matter
  24. 1:14what you're using here because this is
  25. 1:16pretty much the same across all Linux
  26. 1:18distributions and what I did was I
  27. 1:21created a folder and a text file called
  28. 1:25documents and text file respectively so
  29. 1:29what I'm going to do is again show you
  30. 1:31how to understand the numerical value of
  31. 1:34permissions but as a quick refresher
  32. 1:37when you see the permission string which
  33. 1:40is here on the Left which is what you
  34. 1:42get when you use LS dash L the first
  35. 1:45character here is either a D or a hyphen
  36. 1:47and yes there could either be there
  37. 1:49could be other things here but we're not
  38. 1:50going to get into that primarily it's
  39. 1:52going to be D for directory or a hyphen
  40. 1:55for file and then from there we have
  41. 1:56three groups of three so this is Group
  42. 1:58one this is group two and this is Group
  43. 2:02three and individual bits mean read
  44. 2:04write and execute accordingly and a bit
  45. 2:08can either be on or off so this AR if
  46. 2:10it's odd will be the R so we see that it
  47. 2:12is on if it was off the R would become -
  48. 2:16the same for the other characters you
  49. 2:17can't have a W here or X here it's read
  50. 2:21write execute read write execute read
  51. 2:24write execute that's all it can be it's
  52. 2:26either it's on or it's off again watch
  53. 2:29video 9 if that confuses you because you
  54. 2:32should have already gone through that
  55. 2:34in which case that would probably make
  56. 2:36sense so each of these bits actually
  57. 2:38have a numerical value so for example we
  58. 2:41have R which again stands for read that
  59. 2:44has a numerical value of 4w which stands
  60. 2:47for right has a numerical value of 2x
  61. 2:52which is short for execute has a
  62. 2:55numerical value of 1 so 4 to 1
  63. 2:59corresponds to read write and execute
  64. 3:01just as you see here so that might look
  65. 3:04kind of confusing but how does that look
  66. 3:06in practice I think by seeing it in
  67. 3:08practice you'll understand it a bit
  68. 3:11better so here's what we're going to do
  69. 3:13we're going to use the chmod command
  70. 3:16which again we went over in video 9 but
  71. 3:18basically that command is going to allow
  72. 3:20us to change permissions and what I'm
  73. 3:22going to do is change the permissions of
  74. 3:24text file so what I'm going to do now is
  75. 3:27do 4 0 0 and then what I want to change
  76. 3:31permissions on again is text file what
  77. 3:34do you think is going to happen let's go
  78. 3:36ahead and find out so chmod 400 txt file
  79. 3:42we have read Because read is worth 4 as
  80. 3:47I mentioned earlier and 0 0 as you can
  81. 3:51see means pretty much nothing so for
  82. 3:54each of the last groups of 3 so Group 1
  83. 3:58group 2 and group 3 which is user group
  84. 4:05and other respectively
  85. 4:07these actually correspond to that same
  86. 4:10group of 3 as well so for here that I
  87. 4:14change the two is user this 0 is group
  88. 4:18and this 0 is other so each of these
  89. 4:22numbers corresponds to one of the last
  90. 4:24three groups in the permission string so
  91. 4:27by giving it a value of 400 we're
  92. 4:30basically saying that the user section
  93. 4:33which is actually right here is worth a
  94. 4:37value of 4 the other two sections here
  95. 4:41and here are both worth 0 so for
  96. 4:47example if I was to do four for four
  97. 4:52that means everybody has read if I was
  98. 4:57to do let's say zero for zero we can see
  99. 5:04that group has read but no other section
  100. 5:08has that so that's kind of weird you
  101. 5:09probably won't see that in the real
  102. 5:12world but you know you can do it much
  103. 5:14the same way that I could simply do zero
  104. 5:17zero four which gives other read access
  105. 5:22but not the owner of the group again a
  106. 5:24weird permission but that's just to show
  107. 5:26you how that corresponds because every
  108. 5:29time I move the value of four over the
  109. 5:33read value also gets moved over as you
  110. 5:35see so similarly if I was to change it
  111. 5:39to 200 we can see that the owning user
  112. 5:46has write permission and then if I
  113. 5:48change that to zero to zero you see
  114. 5:54right moved over to the next section and
  115. 5:58then again that moved right over to the
  116. 6:04last section
  117. 6:05as I mentioned two is a numerical value
  118. 6:09for right so how do you give each field
  119. 6:13more than just one thing well it's
  120. 6:16simple so we could do chmod 700 text
  121. 6:22file let's see what that does
  122. 6:27that gave user read write and execute
  123. 6:30users the first field here corresponds
  124. 6:34to the second field or the first field
  125. 6:37in the set of three the first field of
  126. 6:39course designates directory or file
  127. 6:41seven is what you get when you add for
  128. 6:44two and one the three values you could
  129. 6:46possibly have so if you were to give it
  130. 6:49for example six that gives it just read
  131. 6:54and write that's because the execute bit
  132. 6:56is worth one we took that away read is
  133. 6:59worth four we
  134. 7:01right is worth 2 4 plus 2 is 6 that's
  135. 7:05how we got that we could do the same
  136. 7:07thing and do let's just say 6 5 5 let's
  137. 7:15see what that gives us so that's kind of
  138. 7:18interesting it gives user read and write
  139. 7:20group read and execute and other read
  140. 7:24and execute no that's kind of kind of
  141. 7:26weird we probably wouldn't want that but
  142. 7:28what we could do 644 which is probably
  143. 7:32something you're more likely to see in
  144. 7:34the real world gives the owner read and
  145. 7:38write the group read and other read as
  146. 7:42well that basically means everybody can
  147. 7:45read this file but only the owning user
  148. 7:47can make changes to it or write to it
  149. 7:50because we gave the owner 6 which is
  150. 7:54basically for read and write to added
  151. 7:58together then we gave group and other 4
  152. 8:01which is read to come up with this
  153. 8:05permission string right here now I
  154. 8:07mentioned in video number 9 that execute
  155. 8:10in a directory means something different
  156. 8:12than file if it's a file with the
  157. 8:14execute bit that means you can run it as
  158. 8:15a program we can see here that the
  159. 8:18folder has execute bit here that's
  160. 8:21required to actually change directory
  161. 8:23into that directory but we can modify
  162. 8:26the permissions of the documents
  163. 8:28directory the same way so chmod 755
  164. 8:32against the documents directory and
  165. 8:37again the command we entered was this
  166. 8:39one this basically means that everybody
  167. 8:42can read the contents of the directory
  168. 8:44and go inside the directory but only the
  169. 8:48owner is able to change the contents of
  170. 8:51that directory
  171. 8:52the owner has write permission if we
  172. 8:55wanted everybody in the world to have
  173. 8:56access full access 777 basically
  174. 9:01highlights it in green that's not always
  175. 9:02going to happen that's just a shell
  176. 9:04customization but you can see that that
  177. 9:06filled in every single permission bit we
  178. 9:08could do the same thing to the text file
  179. 9:14if we can see the text file has all the
  180. 9:18bits set as well so seven gives it
  181. 9:20everything for that field so now we have
  182. 9:23a folder and a file that has everything
  183. 9:27turned on and to take it away we could
  184. 9:29simply do this which basically took that
  185. 9:36away from other you do the same thing to
  186. 9:39documents and the same thing happened to
  187. 9:44documents so again read equals four
  188. 9:48write equals to execute equals one you
  189. 9:53can add these up any way you'd like put
  190. 9:56the value where you'd like to change the
  191. 9:59appropriate permission for and that'll
  192. 10:01give you the numerical value of that
  193. 10:03permission which might be useful to you
  194. 10:06if you prefer that method or if that
  195. 10:08works better for your use case now you
  196. 10:11should actually be able to change
  197. 10:12permission via number as well so I know
  198. 10:15that was a relatively simple video guys
  199. 10:17but in the original video when we went
  200. 10:19over permissions that one was already
  201. 10:21going on kind of long and I wanted to go
  202. 10:24ahead and revisit this in another video
  203. 10:26which I finally had a chance to do in
  204. 10:29this one so I hope that was helpful for
  205. 10:31you guys I'm gonna be creating some new
  206. 10:33tutorials in this series I'll be editing
  207. 10:36some coming up here pretty soon should
  208. 10:37have them uploaded very soon so stay
  209. 10:40tuned and there's going to be definitely
  210. 10:42some more videos in the series thanks
  211. 10:46for checking out my video I really
  212. 10:47appreciate it if you found it useful
  213. 10:49click that like button and if you
  214. 10:51haven't already done so make sure you
  215. 10:53subscribe so you'll see the latest
  216. 10:55content as soon as it becomes available
  217. 10:57if you want to help me out there's links
  218. 10:59down below for my patreon page as well
  219. 11:02as links for purchasing my Linux books
  220. 11:05and also my affiliate store which has a
  221. 11:08listing of Linux compatible hardware
  222. 11:09that I've actually tested personally
  223. 11:12thanks again for watching and I'll see
  224. 11:14you in the next video

About this transcript

This page contains the full transcript of Linux Commands for Beginners 21 - Changing Permissions Numerically by Learn Linux TV, generated from the public captions YouTube serves with the video. The transcript has 1,681 words across 224 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.