Directory Access Permissions/Representation

Unix
Author

Imad Dabbura

Published

October 16, 2023

Directory is represented as a file where the data block where each files/subdirectory inside it has an entry:

Therefore, when we list directory, we read the names from each entry. When we add/rename/remove files/subdirectories, we update the file by adding/updating/removing the entry that corresponds to the file we added.

Meaning of access permissions on a directory:

touch test              // would create a directory with rwx permissions
chmod u-x test          // Remove execute permission
cd test                 // Error: permission denied
touch test/test.txt     // Error: permission denied

We as users never update directory file directory, ONLY kernel does the update and we only get to read its entries.