File Permissions
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.
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.
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/
Thanks, now I get the concept of public_html directories. Would you mind working that into an answer that I can accept?