4

I have two pdf files in my server:

-rwxr-xr-x. 1 apache apache 1422861 Sep 11  2014 file1.pdf
-rwxr-xr-x. 1 apache apache  340815 Aug 27 13:06 file2.pdf

I can access the first one by going to www.myserver.com/pdffiles/file1.pdf

I just uploaded the second one and changed permissions to apache:apache and rwxr-xr-x so I wouldn't have problems with permissions, but when I try to access the second file with www.myserver.com/pdffiles/file2.pdf I get this:

Forbidden

You don't have permission to access /pdffiles/file2.pdf on this server.

What am I missing?

I got the following on my ssl_error_log:

[Thu Aug 27 13:30:46.755295 2015] [core:error] [pid 3025] (13)Permission denied: [client x.x.x.x:60230] AH00132: file permissions deny server access: /var/www/myserver/file2.pdf

5

I didn't know the problem was SELinux but I discovered that was the problem because I turned it off with setenforce 0 and then it worked. This is how it looked when I listed the files with ls -alZ

-rwxr-xr-x. apache apache unconfined_u:object_r:httpd_sys_rw_content_t:s0 file1.pdf
-rwxr-xr-x. apache apache unconfined_u:object_r:user_home_t:s0 file2.pdf

so I fixed it with:

chcon unconfined_u:object_r:httpd_sys_rw_content_t:s0 file2.pdf

and also I turned SELinux back on with setenforce 1.

  • Any sort of ACL would be fairly high on the list of suspects, as would immutability if it was a write problem. – mckenzm Mar 21 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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