**Lecture 27  Chapter 04   section 4.4 Unix File Access Control — Transcript & Summary | SozAI**
Source: https://sozai.app/transcript/unix-file-access-control/

Lecture on Unix file access control: inodes, owner/group IDs, 12 permission bits (rwx plus SetUID, SetGID, sticky), and the order of permission checks.

## Key Takeaways

- Unix access control is anchored in inodes, which store ownership, permissions, and data pointers.
- Permission checks use the first matching class (owner, then group, then others), not a combination of classes.
- Directory permissions govern operations on the entries inside them, which differs from file permissions.
- Special bits (SetUID, SetGID, sticky) modify execution and deletion behavior and are important for security.
- Extended ACLs and masks provide finer-grained control than the traditional 12-bit model.

## What the video covers

- Every file and directory in Unix is represented by an inode (index node), which holds its control metadata; many file names can map to one inode.
- An inode stores the owner ID, group ID, permission bits, file size, registration and update dates, and pointers to the data blocks on disk.
- The disk contains an inode table that maps inodes to their data locations; the space not usable for data is largely used for this metadata.
- Directories form a hierarchy from root, and a directory entry holds only a filename and the inode reference, not the file's full metadata.
- Traditional Unix access control uses 12 bits: SetUID, SetGID, the sticky bit, and nine basic rwx bits for owner, group, and others.
- Read permission on a file lets you read its contents; on a directory it lets you list its entries. Write on a file changes content, while write on a directory allows creating, renaming, or deleting entries inside it.
- Execute on a file allows running it; on a directory it allows traversing and entering it.
- Permission checks follow order: if the user is the owner, owner bits apply; otherwise group bits if the user is in the group; otherwise the others bits, using the first matching class.
- The sticky bit on a shared directory prevents users from deleting or renaming files they do not own.
- SetUID and SetGID let a program run with the file owner's or group's privileges, as in the sudo example.

## Chapters

1. 00:00 Introduction and Overview of Unix File Access
2. 01:09 Inodes, Metadata, and the Many-to-One File Relationship
3. 02:13 Disk Layout, Inode Table, and Directory Hierarchy
4. 03:11 The 12 Protection Bits and Read, Write, Execute Meanings
5. 05:08 Reading Permission Strings and the Permission Check Order
6. 07:08 Special Bits: SetUID, SetGID, and the Sticky Bit
7. 10:16 Limitations of Traditional Control and Extended ACLs
8. 17:08 ACL Masks and the Access Decision Process

Answers

## Questions about this video

What information does an inode store in Unix?

An inode stores the owner ID, group ID, permission bits, file size, registration and update dates, and pointers to the file's data blocks on disk. Each file or directory maps to exactly one inode, while one inode may be referenced by multiple file names.

Why does write permission on a directory matter more than on a file for deleting files?

Deleting or renaming a file changes the directory's entries, so the lecture explains that write permission on the directory is what controls those operations. Write permission on the file only controls changes to its contents.

How does Unix decide which permission set applies to a user?

The system checks in order: if the user is the file owner, the owner bits apply; if not, and the user is in the group, the group bits apply; otherwise the others bits apply. The first matching class is used, not a combination.

## Full Transcript — Download SRT & Markdown

00:02

Speaker A

In the name of God, the Most Gracious, the Most Merciful. Welcome to a new lecture in the Computer and Network Security course. Today, God willing, we will talk about section 4.4 in Chapter 4. It is an example of access control

00:19

Speaker A

for files in the Unix system, Unix file access. Alright. In the Unix system, I have every file or every directory that has something called an index node or inode. Which represents the control for it, right. So every file belongs to one

00:37

Speaker A

index node in the system. And the single index node, as we can see, can have more than one file associated with it. For example, the report.txt file has index node 1, 2, 3, and the copy.

00:52

Speaker A

.txt has index node 1, 2, 3, 4. Both follow the same index node. However, the same file does not belong to more than one index node. Right, it belongs to only one index node. And the relationship between them is what? It's

01:09

Speaker A

many-to-one. Now, what does the index node contain? It contains the owner ID, who created the file or...Who manages the file. What is the group ID that manages the file? My users are divided into groups, right. What are the

01:24

Speaker A

permission bits present on the file? What are the permissions existing on this node? The size of the files or the size of the node in full. And the registration date and the update date.

01:36

Speaker A

And also, what does it tell me? Pointers to data? Where is the data stored for us? On the hard disk. Well, how is it stored on the hard drive? It is reserved with blocks 1, 2, 3. Right, so this data, the blocks stored in it,

01:52

Speaker A

are pointed to by the pointers. It says , here is the pointer to the first block, here is the second, here is the third. Where are they stored? In the existing index node. Alright, that's fine. It tells me...Up...Our hard disk,

02:13

Speaker A

right, or the SSD. It has a table stored in it, right. We have a table at the beginning of the file. Like a dictionary or an index. It tells me that the first node, right...Here is its data and it starts here. And it

02:29

Speaker A

ends here, the second node. Here is its data, and on the hard disk, it starts from here, ends here, and so on, right.

02:38

Speaker A

That is why we find our hard disk is... For example, the hard disk size, say I told you 256. Giga, right. Look at the actual size, you find it, for example, 250, 248. Well, where did this missing space go? And this missing space is

02:56

Speaker A

where? In the dictionary we have, which is the inode table. This is space that you don't utilize. It is present to describe who? To describe the data present inside the hard disk, right.

03:11

Speaker A

The disk holds an inode table, and the file that is...I am opening. Right, it gets loaded where? Into the memory. And for every directory we have. Which is a directory, do we know what a directory is? It is the folder. Every folder we

03:26

Speaker A

have has its own path. Every folder has its own index node. And directories form what? A hierarchy. Here is our root. Right. This is the big, main controller. Right. Underneath it comes home, etc, and tmp. Home comes with,

03:43

Speaker A

for example, Ali and password files. Alright. Each of them forms a, forms... It is built as, just a filename.

03:54

Speaker A

Directory, where is the idea? The file. It is just a directory entry. It does not store file metadata. It stores metadata about the file. It contains the ownership. And the permissions present on it. Okay, fine. The Unix file control system, which is

04:15

Speaker A

traditional Unix access control. Contains how many bits? 12 bits. What about the 12 bits? Every user I have on the system has a user ID. With a primary. Basically belongs to a group.

04:31

Speaker A

And it can belong to more than one. But at least it must belong to. Owner ID, group ID. Alright, each. One of them is called the owner ID. The group ID. The group ID owner is sometimes the same as

04:59

Speaker A

the owner ID's group ID. Or the same group ID as the directory it is in. It does not differ from that. So what are these 12 bits? Those 12 are SetUID, SetGID, and the sticky bit. These are what? Special. These are special bits

05:16

Speaker A

we have, okay. And we have nine bits. The first for the owner, okay, for the owner. Read, write, execute. Read, write, execute. For others, read, write , execute. Basic bits, these are the nine specific basic bits. These are...

05:34

Speaker A

For owner and others, okay. What are the owner's permissions? What permissions are with them? And people.

05:41

Speaker A

Others, besides the owner and the file's group, what is the third permission? Okay, we have three special bits, these change the deletion and execution behavior, as we will see. All this data is stored, the sticky bit data or...12 protection bits. It is

06:10

Speaker A

stored in the file's inode. Read, R means read, I can read the contents. Meaning, read, write, execute, or the three permissions. R means read, from its name, read. I can read the file's contents or the directory's contents.

06:35

Speaker A

Directory contents. To know what files exist. Inside the directory. Write, W. I can change the file content. Or I can create or rename. Or delete a file inside the directory. Now, in the case of execute, in the case of files as

06:57

Speaker A

programs, in the case I'm talking about a file, but if I'm talking about a directory, I can search, I can traverse , I can retrieve the directory tree.

07:11

Speaker A

Directory and enter inside it. And traverse directories within directories . Inside them, so I can reach the entry I want. Okay. So, file read R. Read, write, execute. Bits. R. X. Okay. If I have a script I want to run. Okay. I

07:38

Speaker A

don't have R permission, but I have the X permission. What does it tell me? You can run it. How do you want to run it?

07:45

Speaker A

By having read permission. Here is an important piece of information and a good tip. Directory, we want to create a main page. You write on the directory , not on the file. Okay, I want to delete a file inside the directory. On

08:11

Speaker A

the file or on the directory? I want write permission on the directory, not the file. All right, let's read the root now. When I come to see permissions, okay. Permissions are stored in the following way. The beginning of the permission is either a

08:28

Speaker A

dash, a, or a d. In case it is a dash, it means this permission is for the file. And if it is a d, it means this permission is for the directory, okay.

08:38

Speaker A

Now, let's say we have identified a file or a d. We come to the first permission. The read, write, and execute will be for the owner. Then for the group. For example, I give you read permission. Not giving write permission

08:52

Speaker A

. But giving execute permission. Regarding other people, I give them read permission only. Okay, read permission only. How will I see it written? It will be written like this.

09:06

Speaker A

Well, if I tell you I have a permission given like this. And it's a permission, what does it say? First, the dash means it's a file. Okay, this file, the owner's permission is read and write only. What is the permission for its

09:24

Speaker A

group? Read only, nothing else. What is the permission for others? It says they have none. Any permission on the file?

09:32

Speaker A

Okay. How is the checking order performed? As follows. I come and check , is the user who logged in the file owner? If he is the owner, then he uses the first three bits. But if he is not

09:50

Speaker A

the file owner? I check, is he in the group that has execution permission on the file? If he is in the group and has execution, I apply the group's permission. What if he is neither the owner nor in the group? Who will it be

10:06

Speaker A

then? I will apply the permission of? That of the others, okay. Now, what if someone came along? He was in the group , the users, and the group. And we have the others 'permission, who do I execute for? It says execute for the

10:20

Speaker A

first one that matches. I cannot give him the first, second, and third permissions. No, who? The first one that matches in order from owner to group to others is what I will execute, okay? So if the owner had read

10:36

Speaker A

permission only, okay. And the group had read, do I give him read only or do I give him read? Why? Because the one that matched, okay. Now what do we have ? Special characters, which are the special permissions, SetUID and SetGID.

10:57

Speaker A

It says in the case of execution. The program, when running, the file owner's user ID is active. Okay. I want to run a program that needs files. I will use the user ID. Okay, control. It says I will control the permissions. The

11:23

Speaker A

user's permissions by calling during program execution. Even if others cannot use it with the user ID. The SetGID during execution, it says the file group is. If I were user ID one.

11:39

Speaker A

Let's talk about the Real User ID, which is the main one. One. The opposite of the Effective ID. Defined in the user. Regarding the Group ID.

11:52

Speaker A

The files group becomes the Effective Group ID on the file. This applies to directory file generation. Inherited from directories. Okay. Now, for example, if Ali wants to change his password. He will use Ali's Real ID for it. Now, what if I enabled the

12:13

Speaker A

Effective User ID? The Set User ID will be called. The owner then will be...Or the Set Group ID, the owner then will be the root. And the User ID will then be the owner's. Alright. We have two types. We have the Real IDs and the

12:28

Speaker A

Effective IDs. The Real IDs actually determine who the user is that invoked the file. Okay. ID are for permission checks. Okay. Like when I say Group ID.

12:39

Speaker A

Okay. And all the permissions we have must be checked and returned via the Sticky Bit, originally files in Unix systems. Okay. And what used to be the case is that my file had a meaning. And it was a real file existing on the Unix

13:02

Speaker A

system. Okay. It was opened and loaded into memory directly. But currently, it says this is a thing of the past. So, what does it do for us? It says it gives...Enabled to one, which presses the owner. For example, there is a

13:28

Speaker A

folder called tmp. This tmp folder on Linux is a folder shared between all users. When I enter the tmp folder. We will have the sticky bit at one.

13:38

Speaker A

Meaning that every person who creates a file inside this folder. Has full permissions on the file. Any other person trying to delete the file. Or rename it or change its content. It is prevented from doing so on what? On the

13:51

Speaker A

tmp folder, clearly, or the tmp folder. And the sticky bit is enabled at one.

13:57

Speaker A

Consequently, any user who enters this folder can create files, modify files, and delete files. But only the files that belong to them, which they created themselves. So, they cannot touch other people's files. Now, we have a type of

14:14

Speaker A

user, a special type of superuser, or what I call the root. Of course, traditionally the superuser is the root , okay. The root account's User ID, how much is it? Zero. This one has absolute permissions on all files we have. And

14:29

Speaker A

what can it do? Bypass any existing permission. Okay, the Set User ID, which is a program, Grants this user permissions. Okay. So, how do I use this? We have a command called sudo or Superuser do, when I want to use it and

14:57

Speaker A

I don't have permission. The root has accessed the system. This permission, I say Set User Do. Okay, then I have it execute the command. In this case, the program or Linux will ask me for this user's password. I give it the password

15:13

Speaker A

, and then what happens? Then the interaction happens as this user. Like who? Like a superuser. Oh, okay. Tell me, is it possible? If I have a program with high privileges, this program could access my bytes. The system read

15:38

Speaker A

them with these privileges. Consequently, it leaves the system exposed to real danger. Therefore, I need to review all the permissions I grant to programs. In the case of the process, who is handling our permissions? As we said, read or no

15:56

Speaker A

access to the file. It depends on who the user is, right? Meaning, if I have this file "fxy". I will say to user A, okay. I want to give him read-only access. User B, I want to give him read

16:14

Speaker A

/write. And user C, I want to give him execute. Okay, it tells me if I have a case like this, how do I deal with it in the traditional Linux permission system? The traditional Linux system doesn't give me the privilege to

16:29

Speaker A

distribute operations like that. So, what are we going to do? Use something called Extended Access Control Lists.

16:36

Speaker A

Why doesn't the traditional system give me the privilege to distribute permissions like this? Permissions are either given to the owner, or to the group, or to individuals. Whether they are single individuals or from different groups. We will have a

16:51

Speaker A

problem in this case. Okay, so we have limited flexibility. So why Extended Access Control? It says no, in this case, I can tell a specific user or a specific group, other than the owner or the owner's group, that you get a

17:06

Speaker A

permission. Meaning I come and tell user A your permissions are, for example, read/write. User Sarah has these permissions. User [Name] has these others. This applies to all users . Sarah, you have read. Omar, you have no permissions. Or I come to a group

17:22

Speaker A

and say you have read. Or I could create a mask. What does a mask for everyone mean? Any one of them who comes to access our system, whatever permissions they have, must pass through this mask. Meaning if you are a

17:34

Speaker A

user, okay, if you are a user, for example, you have read, write, and execute. What does the Access Control List mask tell me? It tells me I only want, who, read? So you end up with read. With read, you access the read.

17:48

Speaker A

Well, if you don't have read, then you don't have any permissions on our existing system. This mask of ours, what do I use it for? To control the permissions. If there was a process where I granted absolute permissions to

18:00

Speaker A

a certain file, and I want to limit access to this file. So what is the permission list for us? What do you need first? I need to know who the owner is, then. I need to know which user is allowed to access the file.

18:16

Speaker A

Okay, what about the groups? Right. And what is the mask or the filter we have?

18:20

Speaker A

To limit the effective permissions. Given to whom? To the named users or named groups. Right. After that, I put it through the mask and check. And I give them whom? Only the effective permissions. I don't give them all the

18:34

Speaker A

permissions that were there. How does the Access Control List make this decision in Unix? First, we have someone requesting access to the file.

18:42

Speaker A

For the file access request, I need to check what is appropriate, or what is the suitable permission for them. So, what is the suitable permission? I ask, are you the owner? They say no. Well, are you the named user, or are you?

18:54

Speaker A

From a group, from a group with permissions? Or are you from the others ? You verify with me. First, who do I take? Whose permission do I take? Okay, the mask we talked about, on whom? Does it apply? It applies to named groups,

19:10

Speaker A

named users, or on whom? On groups. It does not apply to whom? To others, okay . After I identify who they are and what their permissions are, I grant them the actual permissions. In the case that they were a named user or

19:25

Speaker A

group, I apply the mask to them. In the case that they were the owner, let them in normally, okay. And check that it is allowed or denied according to the permission I have, okay. Well, what if the user? Had multiple group

19:35

Speaker A

memberships. Okay. And every group has different access controls. On whom? On the file. What do I do? It tells me to listen. Okay. In that case, what will I do? I will take the groups, or one of the groups they have. That has the

19:53

Speaker A

permissions. Okay. And what do I do? Apply the mask I have to it. This way, we have finished section 4.4. God willing, in the next video, we will film, or we will talk about section 4.5 .

Topics: Unix file access control inode permissions SetUID SetGID sticky bit ACL access control list computer security

Study this video

- [Flashcards from this video](https://sozai.app/tools/flashcard-maker/#from=transcript&id=99498)
- [Quiz on this video](https://sozai.app/tools/quiz-generator/#from=transcript&id=99498)
- [Crossword from this video](https://sozai.app/tools/crossword-maker/#from=transcript&id=99498)
- [Word search from this video](https://sozai.app/tools/word-search-maker/#from=transcript&id=99498)
- [Study guide from this video](https://sozai.app/tools/study-guide-maker/#from=transcript&id=99498)

Free, made by AI from this transcript. No signup.


---
This is the markdown twin of https://sozai.app/transcript/unix-file-access-control/ — the same content, without the markup.
Published by SozAI (https://sozai.app). Reuse and quotation are allowed with attribution and a link back.
Machine-readable index: https://sozai.app/llms.txt · data API: https://sozai.app/api/
