For directories, severals references say:

  • r: we can list directory contents
  • w: we can write on directory
  • x: we can change to directory (cd into directory).

But in my tests I got following situation:

  • my user mateus applies to others permission.
  • x is the directory

Only with r permission for others (chmod 704):

If I issue ls -l in directory I got this crazy output:

mateus@engsrv:/tmp$ ls -l x/
ls: cannot access 'x/file_teste': Permission denied
total 0
-????????? ? ? ? ?            ? file_teste

I can't "cat" the file as well.

mateus@engsrv:/tmp$ cat x/haha
cat: x/haha: Permission denied

Ok, let's se what happen only with w permission for others (chmod 702)

mateus@engsrv:/tmp$ touch x/file_test2
touch: cannot touch 'x/file_test2': Permission denied

If I grant execute (chmod 703), I can write to the folder:

mateus@engsrv:/tmp$ touch x/file_test2

The same happens to read permission (chmod 705):

mateus@engsrv:/tmp$ ls -l x
total 4
-rw-rw-r-- 1 mateus mateus 0 Oct  3 17:45 file_test2
-rw-r--r-- 1 root   root   3 Oct  3 17:31 file_teste

So, execution (x) is always necessary? but why? is there something else that need execution permission in background?

  • Does this answer your question? Execute vs Read bit. How do directory permissions in Linux work?
    – Kusalananda
    Oct 3, 2022 at 18:35
  • You did get the listing of the directory, there's the filename file_teste visible in the ls output. The thing to note here is that getting the file metadata isn't possible through just reading the directory, but involves accessing the files themselves. That's probably due to historic reasons and the filesystem structure. There's no execution there, read the x bit as "access" for directories.
    – ilkkachu
    Oct 3, 2022 at 19:29

2 Answers 2


You need to enter (execute) a folder when creating a file (write) in it. Because OS/shell is moving into that folder to create a file. Changing folder is executing it (not directly).

Good point of view to the problem is when you look at folder as a file (in Linux systems) - it is the same as file, but executing it you change your location to inside the folder instead of running (e.g. script, program) it.

But: you can change the folder name even if it does not have write permission (write is for inside of the folder - creating a file). Without execute permission you can't get into folder. If you can execute folder then you can read only or write later inside based on permissions.

EDIT: it was designed this way.

  • Moving into a directory would usually mean to changing the working directory of the process to said directory, with the chdir() system call. But that's not necessary for creating files in the directory, you can just do open("dir/file") directly. Both of them need the x permission, of course, but calling it "executing the directory" is still silly, even the POSIX text calls it "execute/search" (see e.g. chmod but IMO "access" is more apt.
    – ilkkachu
    Oct 3, 2022 at 19:36
  • @ilkkachu right. I wrote this for OP for idea, not exactly going into tech details. In this case let call it access (let me say "xs" ;).
    – pbies
    Oct 3, 2022 at 19:39
  • 1
    yes, that's another reason I like the a-word here, spelling it with an x would fit the pronunciation too.
    – ilkkachu
    Oct 3, 2022 at 19:42

Its just because.

You are not executing anything in the background when you change directory. Executing a directory does not really make sense, so it's x bit its free to be interpreted in any which way. This was the way decided. Not because any code is executed. The sys_chdir syscall checks perms but does not execute anything.

  • it's not interpreted "in any which way", it has a clear and defined meaning.
    – ilkkachu
    Oct 3, 2022 at 19:37

Not the answer you're looking for? Browse other questions tagged .