File Permissions

asked 2014-10-08 01:58:50 -0500

updated 2014-10-08 02:08:20 -0500

I do some webdev stuff and I got tired of the usual /var/www/html path. So I decided to make a symbolic link in my ~ directory (it's called ~/Programming/www-workspace). I added my user to the apache group and changed the ownership of /var/www/html to myusername:apache (using chmod -R). This was somewhat successful in that I can now navigate through those folders as my normal user, I can create files etc.

What is not working though, is the fact that when I put a new file into that folder structure it has my user and group by default. So ls produces something like:

-rw-r-----. 1 myusername myusername  50937 Oct  8 08:18 Chart.min.js

Which means that apache can't access them so I run chmod and chown and get something like this:

-rwxr-xr-x. 1 myusername apache      50937 Oct  8 08:22 Chart.min.js

But apache still can't access it. The only solution that I have come to is to cat Chart.min.js > tmp then rm Chart.min.js then mv tmp Chart.min.js and chmod (although I don't think that's necessary).

It seems stupid that this last attempt should work but chown and chmod don't.

edit retag flag offensive close merge delete

Comments

Did you check the selinux context? Did you check /var/log/audit.log for any selinux denials? Try setting selinux in persmissive mode and then see what you get.

FranciscoD_ gravatar imageFranciscoD_ ( 2014-10-08 02:56:00 -0500 )edit

A simpler way to develop is to set up public_html for each user and use that. It's a bad idea to modify permissions of system directories.

http://www.if-not-true-then-false.com/2010/enable-apache-userdir-with-selinux-on-fedora-centos-red-hat-rhel/

FranciscoD_ gravatar imageFranciscoD_ ( 2014-10-08 02:57:14 -0500 )edit

Thanks, now I get the concept of public_html directories. Would you mind working that into an answer that I can accept?

jcuenod gravatar imagejcuenod ( 2014-10-08 08:30:09 -0500 )edit