1

I'm moving a virtualized centos web server over that has an all-to-small hard drive to a new machine and I hooked up a bigger drive for hosting videos and downloads and stuff. W

When I try to run a readfile or filesize or anything from my PHP script, I get the stat failed error telling me I don't have rights to my file. Everything looks like it should work according to permissions (I can even chmod them 777 all and I get the same problem).

When I put files in the /mnt folder, I can read them, but if I put them in the mounted /mnt/data folder. Other than file/directory level permissions, are there permissions that need to be granted to allow the apache user/group or the httpd service to be able to communicate with mounted drives.

(If this is a security feature, I think it's a great idea, I just need to be able to subvert it in this case)

1

Yes, that's a SELinux security setting, you have to do the following:

chcon -Rv --type=httpd_sys_content_t /mnt/data

that code will update the security contexts for everything in your /mnt/data folder.

more info about SELinux and CentOS

Note, I have no idea why this works of what SELinux security contexts are, I just found the answer to my own questions after writing it down, posting it here and thinking a little bit harder about what I should be looking for.

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.