3

I've got this one file, favicon.ico. It's actually a large group of nested files, but purely for example, just this one.

If I do cp favicon.ico favicon2.ico, Apache can read the second one just fine.

If I do mv favicon.ico favicon3.ico, Apache throws a 403 on favicon3.ico.

If I su apache, I can read the file as apache.

stat says both files are identical, except for the inode number.

Is there some hidden flag somewhere or something that I'm missing? I've never seen anything like this.

error_log says (13)Permission denied: access to /favicon3.ico denied

  • Are you sure the /favicon3.ico path is OK? – vonbrand Mar 13 '13 at 0:00
  • 1
    An answer to another question might offer assistance to others running across this question; it presents a more broad approach to dealing with SELinux issues and web servers : serverfault.com/a/551801/101931 – kbulgrien Jul 20 '18 at 19:50
5

SELinux is denying you access to the file, since you moved instead of copied it from somewhere else on the filesystem into its final location. Thus it kept its original security context, which didn't allow Apache to access it.

To resolve the issue, relabel the file (and probably all the rest of your files).

For example:

restorecon -r -v /var/www/html

To avoid the problem in future, copy files (and delete the original if necessary).

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.