1

Background: I'm running a CentOS VM with Apache installed. The web root is "/var/www/html". There is a subdirectory ("/var/www/html/mp3") which has two mp3's in it. Both mp3's have exactly the same permissions (644). The "/mp3" directory has 755 permissions. I have a database which holds certain information on the songs, and the goal is ultimately to be able to enter search terms and have a php script which returns songs that have those keywords in them, and allow you to play them. I am using the default "httpd.conf" configuration.

Issue: I can only see one of the songs. When /mp3 is accessed you get a directory which has only "MasterOfPuppets.mp3"; it does not show "One.mp3". When you access "/mp3/MasterOfPuppets.mp3" it will allow you to play the song; when you access /mp3/One.mp3 it shows 403: Access Forbidden. I'm almost confident that this is a permissions issue, but given that the permissions are exactly the same for both files I have absolutely no idea how this could happen.

Does anybody have any idea whatsoever as to what could be causing this problem? I've been banging my head against the wall for the past 3 hours. Google has failed me.

Edit:

[root@dugan mp3]# ls -lrtZ *mp3
-rw-r--r--. root root unconfined_u:object_r:home_root_t:s0 One.mp3
-rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 MasterOfPuppets.mp3

Edit2:

It was a SELinux problem. I found documentation here: Here

in the "/mp3" folder I entered "chcon -t httpd_sys_content_t One.mp3" and did another another "ls -lrtZ *mp3", which got me this:

-rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 One.mp3
-rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 MasterOfPuppets.mp3

Problem solved, I can now access One.mp3. SELinux is best Linux. Thanks for the help all.

slm
  • 7,355
  • 16
  • 54
  • 72
Caldwell
  • 11
  • 1
  • Please add the output of `ls -lrtZ *mp3` to your question. – dawud Oct 12 '13 at 17:19
  • 2
    You say "weird permission issue with CentOS", I think "selinux". Check `/var/log/audit/audit.log` and see if One.mp3 is mentioned. – TessellatingHeckler Oct 12 '13 at 18:11
  • If the problem is solved, you should answer your own question (so it is not listed as a question waiting for an answer). Or better yet, poke @TessellatingHeckler to post his selinux answer to get the points. – Andy Shinn Oct 14 '13 at 03:28

1 Answers1

1

Copied from a comment to an answer:

You say "weird permission issue with CentOS", I think "selinux". Check /var/log/audit/audit.log and see if One.mp3 is mentioned.

TessellatingHeckler
  • 5,676
  • 3
  • 25
  • 44