Apache directory structure
I have everything residing in /var/www/my.domain1, /var/www/mydomain.2 etc.
I have changed the owner/group to www-data for the entire /var/www directory and subdirectories from root for security reasons.
I use my normal user for all administration and uploading/creating html, php files etc. The problem I have run into however is that when I create new files they are then owned by my user account (as expected) and then I do a chown to www-data. This is becoming a little labor intensive given the amount of files I have been dealing with. I would like the files to owned by www-data from the moment they are created without actually having to login as that user.
Is there an easier more preferred method to what I am trying to accomplish here without re-inventing the wheel?
3 Replies
chown -Rv www-data:www-data /var/www
You could even write a bash script that does this whenever you need.
setgid bit