Linux Commands for Beginners 21 - Changing Permissions Numerically — Transcript
Full transcript
- 0:00[Music]
- 0:21hello again everyone in today's video we
- 0:24are going to revisit permissions we've
- 0:26already gone over permissions in video
- 0:28number 9 so if you haven't already seen
- 0:30video 9 I highly suggest that you watch
- 0:33that one first because in this video I'm
- 0:36going to show you how to understand the
- 0:38numerical value of permissions and in
- 0:42video number 9 we took a introduction
- 0:44look at permission so we're going to get
- 0:46a little bit more advanced in this video
- 0:49it's not too bad though so in this video
- 0:51you'll understand the numerical value of
- 0:53permissions and that's definitely an
- 0:55important thing to know so let's go
- 0:57ahead and dive right in so here are my
- 0:59terminal I have a brand new Ubuntu
- 1:03instance I created on Linode because I
- 1:05wanted a clean instance for the purposes
- 1:08of this video I didn't want to change
- 1:10permissions on my actual files and
- 1:12folders but it doesn't really matter
- 1:14what you're using here because this is
- 1:16pretty much the same across all Linux
- 1:18distributions and what I did was I
- 1:21created a folder and a text file called
- 1:25documents and text file respectively so
- 1:29what I'm going to do is again show you
- 1:31how to understand the numerical value of
- 1:34permissions but as a quick refresher
- 1:37when you see the permission string which
- 1:40is here on the Left which is what you
- 1:42get when you use LS dash L the first
- 1:45character here is either a D or a hyphen
- 1:47and yes there could either be there
- 1:49could be other things here but we're not
- 1:50going to get into that primarily it's
- 1:52going to be D for directory or a hyphen
- 1:55for file and then from there we have
- 1:56three groups of three so this is Group
- 1:58one this is group two and this is Group
- 2:02three and individual bits mean read
- 2:04write and execute accordingly and a bit
- 2:08can either be on or off so this AR if
- 2:10it's odd will be the R so we see that it
- 2:12is on if it was off the R would become -
- 2:16the same for the other characters you
- 2:17can't have a W here or X here it's read
- 2:21write execute read write execute read
- 2:24write execute that's all it can be it's
- 2:26either it's on or it's off again watch
- 2:29video 9 if that confuses you because you
- 2:32should have already gone through that
- 2:34in which case that would probably make
- 2:36sense so each of these bits actually
- 2:38have a numerical value so for example we
- 2:41have R which again stands for read that
- 2:44has a numerical value of 4w which stands
- 2:47for right has a numerical value of 2x
- 2:52which is short for execute has a
- 2:55numerical value of 1 so 4 to 1
- 2:59corresponds to read write and execute
- 3:01just as you see here so that might look
- 3:04kind of confusing but how does that look
- 3:06in practice I think by seeing it in
- 3:08practice you'll understand it a bit
- 3:11better so here's what we're going to do
- 3:13we're going to use the chmod command
- 3:16which again we went over in video 9 but
- 3:18basically that command is going to allow
- 3:20us to change permissions and what I'm
- 3:22going to do is change the permissions of
- 3:24text file so what I'm going to do now is
- 3:27do 4 0 0 and then what I want to change
- 3:31permissions on again is text file what
- 3:34do you think is going to happen let's go
- 3:36ahead and find out so chmod 400 txt file
- 3:42we have read Because read is worth 4 as
- 3:47I mentioned earlier and 0 0 as you can
- 3:51see means pretty much nothing so for
- 3:54each of the last groups of 3 so Group 1
- 3:58group 2 and group 3 which is user group
- 4:05and other respectively
- 4:07these actually correspond to that same
- 4:10group of 3 as well so for here that I
- 4:14change the two is user this 0 is group
- 4:18and this 0 is other so each of these
- 4:22numbers corresponds to one of the last
- 4:24three groups in the permission string so
- 4:27by giving it a value of 400 we're
- 4:30basically saying that the user section
- 4:33which is actually right here is worth a
- 4:37value of 4 the other two sections here
- 4:41and here are both worth 0 so for
- 4:47example if I was to do four for four
- 4:52that means everybody has read if I was
- 4:57to do let's say zero for zero we can see
- 5:04that group has read but no other section
- 5:08has that so that's kind of weird you
- 5:09probably won't see that in the real
- 5:12world but you know you can do it much
- 5:14the same way that I could simply do zero
- 5:17zero four which gives other read access
- 5:22but not the owner of the group again a
- 5:24weird permission but that's just to show
- 5:26you how that corresponds because every
- 5:29time I move the value of four over the
- 5:33read value also gets moved over as you
- 5:35see so similarly if I was to change it
- 5:39to 200 we can see that the owning user
- 5:46has write permission and then if I
- 5:48change that to zero to zero you see
- 5:54right moved over to the next section and
- 5:58then again that moved right over to the
- 6:04last section
- 6:05as I mentioned two is a numerical value
- 6:09for right so how do you give each field
- 6:13more than just one thing well it's
- 6:16simple so we could do chmod 700 text
- 6:22file let's see what that does
- 6:27that gave user read write and execute
- 6:30users the first field here corresponds
- 6:34to the second field or the first field
- 6:37in the set of three the first field of
- 6:39course designates directory or file
- 6:41seven is what you get when you add for
- 6:44two and one the three values you could
- 6:46possibly have so if you were to give it
- 6:49for example six that gives it just read
- 6:54and write that's because the execute bit
- 6:56is worth one we took that away read is
- 6:59worth four we
- 7:01right is worth 2 4 plus 2 is 6 that's
- 7:05how we got that we could do the same
- 7:07thing and do let's just say 6 5 5 let's
- 7:15see what that gives us so that's kind of
- 7:18interesting it gives user read and write
- 7:20group read and execute and other read
- 7:24and execute no that's kind of kind of
- 7:26weird we probably wouldn't want that but
- 7:28what we could do 644 which is probably
- 7:32something you're more likely to see in
- 7:34the real world gives the owner read and
- 7:38write the group read and other read as
- 7:42well that basically means everybody can
- 7:45read this file but only the owning user
- 7:47can make changes to it or write to it
- 7:50because we gave the owner 6 which is
- 7:54basically for read and write to added
- 7:58together then we gave group and other 4
- 8:01which is read to come up with this
- 8:05permission string right here now I
- 8:07mentioned in video number 9 that execute
- 8:10in a directory means something different
- 8:12than file if it's a file with the
- 8:14execute bit that means you can run it as
- 8:15a program we can see here that the
- 8:18folder has execute bit here that's
- 8:21required to actually change directory
- 8:23into that directory but we can modify
- 8:26the permissions of the documents
- 8:28directory the same way so chmod 755
- 8:32against the documents directory and
- 8:37again the command we entered was this
- 8:39one this basically means that everybody
- 8:42can read the contents of the directory
- 8:44and go inside the directory but only the
- 8:48owner is able to change the contents of
- 8:51that directory
- 8:52the owner has write permission if we
- 8:55wanted everybody in the world to have
- 8:56access full access 777 basically
- 9:01highlights it in green that's not always
- 9:02going to happen that's just a shell
- 9:04customization but you can see that that
- 9:06filled in every single permission bit we
- 9:08could do the same thing to the text file
- 9:14if we can see the text file has all the
- 9:18bits set as well so seven gives it
- 9:20everything for that field so now we have
- 9:23a folder and a file that has everything
- 9:27turned on and to take it away we could
- 9:29simply do this which basically took that
- 9:36away from other you do the same thing to
- 9:39documents and the same thing happened to
- 9:44documents so again read equals four
- 9:48write equals to execute equals one you
- 9:53can add these up any way you'd like put
- 9:56the value where you'd like to change the
- 9:59appropriate permission for and that'll
- 10:01give you the numerical value of that
- 10:03permission which might be useful to you
- 10:06if you prefer that method or if that
- 10:08works better for your use case now you
- 10:11should actually be able to change
- 10:12permission via number as well so I know
- 10:15that was a relatively simple video guys
- 10:17but in the original video when we went
- 10:19over permissions that one was already
- 10:21going on kind of long and I wanted to go
- 10:24ahead and revisit this in another video
- 10:26which I finally had a chance to do in
- 10:29this one so I hope that was helpful for
- 10:31you guys I'm gonna be creating some new
- 10:33tutorials in this series I'll be editing
- 10:36some coming up here pretty soon should
- 10:37have them uploaded very soon so stay
- 10:40tuned and there's going to be definitely
- 10:42some more videos in the series thanks
- 10:46for checking out my video I really
- 10:47appreciate it if you found it useful
- 10:49click that like button and if you
- 10:51haven't already done so make sure you
- 10:53subscribe so you'll see the latest
- 10:55content as soon as it becomes available
- 10:57if you want to help me out there's links
- 10:59down below for my patreon page as well
- 11:02as links for purchasing my Linux books
- 11:05and also my affiliate store which has a
- 11:08listing of Linux compatible hardware
- 11:09that I've actually tested personally
- 11:12thanks again for watching and I'll see
- 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.