Score:1

Two files, same permissions, Apache says one is forbidden

kr flag

I have two files in a directory that is accessible to the Interent. It's part of a WordPress installation. Here are the directory contents:

# ls -lah
total 11M
-rw-r--r--. 1 apache apache 2.9M Jul  6 01:49 June_16.pdf
-rw-r--r--. 1 apache apache 2.6M Jul  5 14:17 June_23.pdf
-rw-r--r--. 1 apache apache 2.4M Jul  5 14:17 June_30.pdf
... few other files...

They all have the same permissions. Except I can view / download two of the files, but cannot view / download the one of them. For the one I cannot view / download, Apache gives a 403 forbidden failure. It happens for this pdf file no matter what directory I put it in.

On my local machine (MacOs), I can view the file and it's a valid pdf. I also cannot upload this PDF file via the WordPress Media Upload page.

What could be going on here?

Just FYI here are links to the files:

https://www.qctonline.com/wp-content/uploads/2021/07/June_16.pdf

https://www.qctonline.com/wp-content/uploads/2021/07/June_23.pdf

https://www.qctonline.com/wp-content/uploads/2021/07/June_30.pdf

Score:1
ma flag
  1. Look through your apache access and error logs in /var/logs/, there should be more details there.
  2. Try renaming the file to see if it is name-related. There could be something in your .htaccess that's causing this.
kr flag
The `ssl_error_log` just complaining about the permissions, not a `client denied by server configuration`: [Tue Jul 06 03:42:46.151641 2021] [core:error] [pid 29936] (13)Permission denied: [client 1.2.3.4:50762] AH00132: file permissions deny server access: /var/www/html/web-root-dir/wp-content/uploads/2021/07/June_16.pdf
kr flag
Change file name, issue persists with new filename.
kr flag
My mind is boggled. I was considering malware, since the same file could not be uploaded into the media store page of WordPress.
d4n3sh avatar
ma flag
Have you tried saving/exporting the PDF to a new pdf file?
kr flag
Yes, I tried that using Mac Preview app.
d4n3sh avatar
ma flag
Is this a Redhat/CentOS box by any chance? SELinux?
kr flag
Yes, it is. SELinux is enforcing and read permissions has been given to the directory where all the files are stored together. I don't know about any more advanced SELinux settings that would block a particular file.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.