Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

My www files is located at ~/www, and I change the owners of the files to myuser:www-data.

However, when I create new file by the user, it doesn't get the group (www-data) by his owner.

How can I define that every file who will create in ~/www will owned by myuser:www-data automatically?

share|improve this question

Since you only need to change the default group ownership, set the 'setgid' bit (g+s) on your ~/www directory.

It's not possible to change the default user ownership, however.

share|improve this answer
I'd have to disagree on the defalt user ownership, but it is more compilcated, you'd have to delve into the world of ACLs in Linux and UNIX which are not commonly used. – mdpc Feb 1 '13 at 3:10
@mdpc: POSIX ACLs can only set default permissions, not user/group ownership. – grawity Feb 1 '13 at 10:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .