Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


Saw this question:

Why can't my apache process write to my world-writeable file?

Could this be SELinux related, currently /etc/sysconfig/selinux is setting to permissive:



Disabled SELINUX, no change.

Platform: This on CentOS 5.5, Apache 2

ls -l gives

-rw-rw-r-- 1 root mail 9230 Mar 2 10:25 2011 MyFile.txt

I need to give apache user read access to /var/MyApp directory.

I do:

chmod a+r /var/MyApp -R

And ls -l confirms that all file permissions have changed to allow any user to read. But when I do this

sudo -u apache tail /var/MyApp/MyFile.txt

I get this error:

tail: cannot open `/var/MyApp/MyFile.txt' for reading: Permission denied

Does apache user require some special configuration to allow read access?

share|improve this question

migrated from Mar 28 '11 at 13:08

This question came from our site for professional and enthusiast programmers.

You forgot to mention the platform. – Ignacio Vazquez-Abrams Mar 2 '11 at 6:36
@Ignacio: updated – gAMBOOKa Mar 2 '11 at 6:37
your file have correct permission ? (file not folder) – Efazati Mar 2 '11 at 6:43
@Efazati: Yes, question has been updated with ls -l showing file permission – gAMBOOKa Mar 2 '11 at 6:44
Can the current user read the file, e.g. tail /var/MyApp/MyFile.txt ? – William Mar 28 '11 at 11:19
up vote 1 down vote accepted

Could be an execute bit problem on /var or /var/MyApp. Make sure both /var and /var/MyApp are chmod a+x. Also make sure that the apache user's shell isn't disabled (e.g., /sbin/nologin or /bin/false)

share|improve this answer

No, but chmod, like many UNIX commands, doesn't like it when you put options after arguments. Put the -R before the a+r and see if that helps.

share|improve this answer
ls -l gives -rw-rw-r-- 1 root mail 9230 Mar 2 10:25 2011 MyFile.txt – gAMBOOKa Mar 2 '11 at 6:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.