Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Before I begin, I apologize if this may seem as if it is a duplicate question, but no responses that I have found have been able to solve my problem.

I have a server setup running my company, with several users on the system.

When working with the website, all files need the permissions of www-data, however, when i create a file as matt or taylor, the files are always created with the users default permissions, so matt:ceo or taylor:staff. I need new files in the www-data directory to always inherit the permissions of {user}:www-data as well as have a default permission setting of 660.

In my current setup, I need to use sudo to chmod, and chown to correct everything.

Any and all help is greatly appreciated.

share|improve this question
up vote 1 down vote accepted

If you set the setgid bit for the www-data directory, all the files created under it will have the group set to that of the directory. The command to do this is:

chmod g+s www-data

Don't forget to add the users to the group that owns the directory, e.g.

usermod -a -G www-data matt
usermod -a -G www-data taylor

I don't know how you can set the default permission to 660 except using umask but that will apply to all files no matter where are created.

share|improve this answer
Well then... that was simple... thanks a ton. – Matt Clark Dec 23 '12 at 18:02

Permissions can be inherited using default ACLs, if your filesystem supports them:

setfacl -d -m u::rwx,g::rwx,o::- www-data
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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