File versus directory permissions
Quick answer
The same r, w and x letters mean different operations on a regular file and a directory. Understanding that difference explains why a readable file may still be inaccessible.
Prepare the practice environment
Use the chapter fixture described in lab-fixtures/permissions/README.md. Run setup as a normal user in a disposable Linux environment, enter the printed directory, check pwd, and run export LC_ALL=C; umask 022. Every example assumes a fresh fixture. Commands omit the terminal prompt; outputs below are not commands.
How it works
For regular files, r permits reading contents, w permits modifying contents, and x permits execution subject to other requirements. For directories, r permits listing names, w allows changing entries when combined with search permission, and x permits searching/traversing known names. Deleting a file generally requires write and search access on its parent, not write permission on the file itself; sticky bit, ACLs, mount policy and attributes may add restrictions. A directory can be searchable but not listable.
Think of a directory as a mapping from names to file objects. In a private directory with mode 0300, its owner can create an entry or open a known readable file, but cannot list all names. With mode 0400, the owner can list names but cannot open a file by its name inside that directory. Opening the file also requires permission on the file itself. These examples assume no ACL or overriding privilege.
Try the examples
Owner search permission lets cat resolve the known name; listing is not granted. Restore the directory mode afterward.
Expected stdout:
hellochmod 400 roomls -1 --color=never roomif cat room/note.txt 2> /dev/null; then printf 'unexpected\n'; else printf 'blocked\n'; fichmod 700 roomThe name is visible but its contents cannot be reached. The diagnostic is hidden here only to keep the example output concise.
Expected stdout:
note.txtblockedchmod 400 room/note.txtrm -f -- room/note.txttest ! -e room/note.txt && printf 'entry removed\n'Only the synthetic note is removed. The parent is writable and searchable. -f avoids an interactive confirmation, not permission checks.
Expected stdout:
entry removedCommon mistakes
Never infer that a read-only file cannot be deleted. Do not remove real files to test permissions; use the provided fixture only.
Practice
Predict whether you can read room/note.txt when room has mode 600; then verify with cat and restore 700.
Related references
Study: chmod, stat. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
File versus directory permissions — Knowledge Check
Apply the lesson concepts to the controlled permission fixture.
What does x on a directory allow?
Which access is needed to list names?
What normally controls deleting a file entry?
A directory has 400 for its owner. Can the owner open a known child normally?