This is somewhat confusing for me so i hope someone can quickly explain the run down once and forall.

I have a User, "John", and group created named "John". I make john a "Primary group members" of group John, and user www-data a member also of group John.

I create /home/john and chown john:john.

files and directories are chmod 755, so it makes sense then that www-data cannot write, which i want it to.

Do i need to chmod everything to 775, or is there a better way to go about this securely?


There are different ways to go:

  1. chmod 775
    If I understood you correctly, the user www-data is part of the group john. So in this setting this user can also write to your directories.
  2. chown www-data
    You can also transfer the ownership of your directories to www-data. Now obviously www-data can write. However in this setting the user john can't write.
  3. Use POSIX ACLs
    ACL stands for access control list. Using this mechanism you can give additional users additional rights, i.e. write for www-data. See this answer for a description: How to make a directory with permanent permissions different from default

I think 755 is appropriate permission if you don't want other group members to write to that area and read only, but if you really want groups to write should use 775.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.