What does 'x' permission mean for a directory?

QuestionsQuestions8 SkillsProDec, 18 2025
0180

In Linux, the x (execute) permission on a directory means something very specific and different from a regular file:

The x permission for a directory means Search/Access permission.

Without the x bit, a directory is essentially "locked" even if you have permission to see it. Here is what it allows you to do:

  1. Enter the directory: You need the x permission to use the cd (change directory) command to enter that folder.
  2. Access file metadata: You need the x permission to access the files inside (e.g., to read a file's content or see its properties), provided you know the filename.

A Quick Comparison:

  • r (read): Allows you to list the names of the files inside the directory (using ls).
  • x (execute): Allows you to traverse or pass through the directory to reach its contents.

An Analogy:

  • r (read): Is like being able to look through a glass window at a room and see a list of items on the table.
  • x (execute): Is like having the key to the door so you can actually walk into the room.

Try this thought experiment:
If a directory has r permissions but no x permissions:
You can run ls and see the names of the files, but if you try to cd into it or try to open one of those files, the system will say "Permission denied".

0 Comments

no data
Be the first to share your comment!