By cloudnine
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 username so 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!
@hansen, yes. At the moment, I see the following in the home directory of each user’s account:
root@host:/home/<username># ls -la
total 247936
drwxr-xr-x 4 username username 4096 Jul 7 18:51 .
drwxr-xr-x 5 root root 4096 Feb 5 00:25 ..
-rw------- 1 username username 7017 Jul 8 13:09 .bash_history
-rw-r--r-- 1 username username 220 Feb 5 00:23 .bash_logout
-rw-r--r-- 1 username username 3637 Feb 5 00:23 .bashrc
drwx------ 2 username username 4096 Feb 9 02:06 .cache
-rw------- 1 username username 119 Feb 10 12:04 .mysql_history
-rw-r--r-- 1 username username 675 Feb 5 00:23 .profile
drwxr-xr-x 19 username username 4096 Jul 8 15:16 public_html
Depending on the configuration, it might have a .ssh folder as well, with the public key. In the above example, public_html shows 755 permissions, which I set manually.
Thanks for offering to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.