Appache and Permissions Part 2
Appache and Permissions Part 2
Video Transcript
00:00Alright, we're almost done with permissions, but it's so important for me to know that you get it.
00:04So I left one part out, because I want to talk about it a little bit further. We're going to
00:09expand a bit on permissions, and this video is critical. You won't be able to continue onwards,
00:13or you won't succeed in getting your server up without this video. Alright, so let's start.
00:19First of all, I want to again look at that directory where our file is, that www file.
00:25Now the regular ls command is basically just showing us all the non-hidden files and folders
00:31that are inside of my current folder that I'm in, the current home folder for this
00:35demo user that we are in. What I want to do in the next step is I want to actually go into this
00:41folder and see what is, I want to see what who owns this folder, what are the permission levels
00:48in that folder. So to do that, I'm going to type ls and then minus l. That is going to give
00:53me a list with a lot more information about the file such as the creation date and a few
00:59other pieces of information. Now the critical part here is the user that created supposedly or owns
01:04this file is Apache. The group that has access to this file is Apache as well. Now when we're
01:11looking into this dr, wxr, xrx, what this means is that the user Apache has write, execute,
01:21and read writes. While the group Apache only has execute and read. While the last and absolute
01:30final one only has the execute write. What that means is that we can't look into the file,
01:36we could only execute the file. So we could see that the file exists but we can't go inside and
01:41edit it with the x command. We can't even read it, we can't even see the file. It's not a read
01:46only, it's only executable. We could only command it, we can only access it but nothing beyond them.
01:53All right, so now this is the critical operation and critical part here. Now the next step involved
01:58is for our server to be able to even access this folder that it owns, it needs to be able to travel
02:04through and access that file. So first we want to make sure that the pathway for Apache enables
02:11it to walk through. Now Apache doesn't need a write access, it doesn't even need read access for it
02:17to be able to travel through and get to a file but it needs to have access. If it's denied all access
02:23it won't be able to even get to this folder and thus it wouldn't be able to execute it. So what
02:28I want to do is I want to click back to this home directory so that out of the home directory
02:32all the way to the core root directory by typing cd slash with a space in it, very important.
02:40Once I do that I'm going to be in the in that base folder. Now by the way our demo folder is located
02:47inside of the home folder and every new account is located in the home folder so if I wanted to go
02:51into it I would I would type probably cd home and then demo. If I didn't type that cd shortcut
02:58that cd shortcut which is that you know that that squiggly line that we talked about in
03:02one of the previous videos. But what I want to do now is I want to show you the traveling
03:07lines. I'm just going to clear this and I want to look at everything inside of this folder including
03:12the access levels. I'm going to get that list with all the information. I want to find that home
03:17folder which you'll find right here and you'll see that this if we go all the way here first
03:21the root created it it belongs to the root group and we can see that anyone only the root could
03:27read write and execute. Only people and only users in the group root could actually execute
03:33and read means that it's a read-only file that they could also execute while everyone else could
03:38execute the file. So I'm going to go right in there into the home folder and as I'm in the
03:43home folder I'm going to again I'm going to just clear things out here and I want to in the home
03:46folder just list out all the users basically all the folders and you can see that I have
03:51your folder called bender and you can see that in the folder bender the user bender has read
03:56write and execute while everyone else has no rights at all. And again in the demo account
04:02we'll see which is the account that we're working on the demo user could read write and execute
04:07but the next three tabs mean that the demo group doesn't have any access at all and the
04:16everyone else anyone else that is not in the user or the group has no access at all.
04:21Now by the way if we wanted to we could change the access level and basically say okay so
04:27demo could own it but also anyone inside Apache could be the sub user if we would use this
04:32uh ch uh own by changing the owner and saying okay the the user is banned but the group is
04:38Apache so the Apache could have access then we can define what access levels we want.
04:42But really in our state what we want is we want Apache to just be able to execute to be
04:48able to access the file. So what we want to do and we don't have to do this recursively
04:52because we don't want to change the permissions that are inside of the user we just want to make
04:55sure that the user Apache which we're going to be working with when the server is trying to
05:00interact with our application they'll have access. So to do that I'm going to do I'm going to use the
05:06command ch mode because we want to change the mode we want to modify that area and we want
05:12to keep that user demo to have full access but we only want to have a very very basic execution
05:18access for the user for all other users that are in the group or not in the group and we
05:24want to do that for the folder demo. Now once we do that if we do that LSLI again we could see that
05:31now anyone in that demo group could now execute they cannot read or write they cannot access
05:37they cannot change or modify or or read anything in here and they can only execute the same
05:42as true for any user that is outside which basically means that any user could access
05:46this folder. Now if we don't have any private information which we don't we're fine with that
05:51by default new users don't have and no one could look at the files not talk about even so in this
05:57case users like Apache will be able to access this folder but they won't be able to read or write
06:03into these files and folders. So by doing this we're enabling our server to be and gain access
06:10to that folder that's inside of demo where it has all the access rights that full access rights
06:15where it could do whatever it wants. All right so that's all about that uh specifically so the
06:21importance of making sure that our Apache could actually get to that folder so no matter what
06:26folder you're going to put your files in you're going to want to make sure that the traveling
06:31path all the way into until you get to that folder where Apache has the access levels that
06:36we've created in the last video that Apache has actually executable writes throughout because
06:41if it doesn't it can't even get into the folder so it doesn't really matter what the permissions
06:45internally are. All right so that's it so we've set our folder in the next video in our next
06:51session we're going to go inside and create our first simple web page to get us ready to actually
06:57actually connect it to our server so see in the next video where we create our first
07:01simple html page that will be used for our server configuration.
