Skip to content

Files and finding

8 min

The execute bit on a directory

Three triples, checked in order and exclusively.

A mode is three triples: owner, group, everyone else. They are checked in that order and exclusively — if you are the owner, only the owner triple applies, and being in the group cannot give back a permission the owner triple denies.

chmod 077 file locks the owner out of their own file while everyone else reads it. That is not a bug; it is the rule.

Try this

On a directory the bits mean something different. Read is permission to list it; execute is permission to traverse it. They are independent.

A directory with --x can be walked through but not listed: you can read a file inside it if you know its name. One with r-- can be listed but nothing inside it can be reached.

Try this

$

Files

The files in the sandbox, with their modes, link counts and sizes
ModeLinksSizeName
drwxr-xr-x3exports/
-rw-r--r--129a.txt
-rwxr-xr-x118script.sh
drwxr-xr-x3work/
-rw-r--r--129b.txt
-rw-r--r--136c.log
drwxr-xr-x2deep/
-rw-r--r--129d.txt
-rw-r--r--133top.txt