It’s not clear to me if my linux permission settings are secure or if I am making a mistake. I would be glad if someone chimed in on my setup running Php5-fpm on Ubuntu 14.04:
chown -R username:username)
usermod -a -G www-data usernameso that Apache can write to the few folders/files inside public_html that it needs to.
Technically, in any application, Apache should only need to read most files and write to a few directories or files, which I believe is the whole point of NOT setting ownership of the entire document root to username:www-data.
But, in my setup, all the files within a user account (document root) have permissions set to -rw-rw-r– and all the directories within the document root have permissions set to drwxrwxr-x. This makes me a bit nervous as it seems like Apache can write to all the files and directories within the user account space as the user has been added to the www-data group.
I hope someone with a better understanding of file permissions can comment on this setup.
Or, is my setup correct/secure and I just need to set the proper umask for the user?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $200 of credit to try our products over 60 days!