What does the execute permission mean on a directory?
On a directory, execute (x) means permission to enter it and access items by name. Read (r) lets you list names, and write (w) lets you create or delete entries. Without x on a directory you cannot cd into it or open files inside, even if the files themselves are readable.
Explain it simply
A directory is like a lift lobby in an apartment. Execute is the permission to walk in and reach the flats. Read is permission to see the board listing flat names. Write is permission to add or remove names from that board.
So the three bits work differently than on files:
rletslslist names.xlets youcdin and open known files, and reach everything below.w(together withx) lets you create, rename and delete entries.
Combinations that surprise people: r-- lists names but you cannot read their details or open them; --x lets you open a file if you know its exact name but you cannot list the folder. That second pattern is a real technique for hiding files in shared hosting.
Also, to reach /home/amit/docs/a.txt you need x on every directory in the path.
Example
mkdir box && echo hi > box/a.txt
chmod 600 box # remove x
cat box/a.txt
# cat: box/a.txt: Permission denied
chmod 700 box
cat box/a.txt
# hiWhat to say in the interview
"For directories, r lists names, x allows entering and accessing items, and w with x allows creating and deleting entries. A missing x on any folder in the path blocks access to everything beneath it, even if the file itself is readable."
Common mistakes
- Giving directories 644; they need x to be usable.