9

It has always baffled me that if a folder has read and write permissions, Apache + PHP can't write to it. You have to end giving apache execution permissions to be able to write a file in that folder. Why?

For example with chmod 664 (where the build group includes the apache user) apache won't be able to write a temporary cache file in this folder:

drw-rw-r--  5 jenkins build 4096 Jun 15 13:05 cache

while with chmod 774 apache will be able to write a new file to the folder:

drwxrwxr--  5 jenkins build 4096 Jun 29 11:44 cache

2 Answers 2

11

You need execute permission to conceptually enter a directory (cd into it, list files within, etc.). It would have been clearer if they called this bit something else for directories. This article recommends thinking of it as the "search" permission on directories.

Sign up to request clarification or add additional context in comments.

Comments

2

When these permission are set for a directory it gives ability to access metainfo and accessing to contents I think this is why you need execute.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.