Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Let's say that we have 2 users: a and b, that are both part of group general.

I would like that any file or folder that A creates, would have write permission to the group GENERAL.

How can I do it?

For instance, the newly created file is set as:

-rw-r--r-- 1 a general

This doesn't give write permission to the group general

share|improve this question
You might be interested in this answer: stackoverflow.com/questions/3175303/… –  Gavriel May 15 '13 at 21:57
I don't want to do it from Java. This is not the right way to do it –  Odelya May 16 '13 at 4:41

1 Answer 1

up vote 4 down vote accepted

Yes, you can do that changing the umask. The umask determines which are the default permissions for a newly creted file.

You can add umask g+w at the end of your shell configuration file (~/.bashrc for example).

But actually, it´s not a recommendable practice. In the case you do want to ensure the integrity of a file and you forget to update the file permissions, it will be modifiable by the group. It's against the "secure initial values" principle of security.

What you could do instead is make all the newly created file of a specific directory writable by the group. You can do this manipulating the ACLs of the directory. For example, setfacl -dm u::rw,g::rw,o::r ~/shared.

Look at those posts for reference : http://serverfault.com/questions/349145/can-i-override-my-umask-using-acls-to-make-all-files-created-in-a-given-director and http://stackoverflow.com/questions/580584/setting-default-permissions-for-newly-created-files-and-sub-directories-under-a.

share|improve this answer
What if I don't know what the directory will be? Since let's say that I have folder TEST. All the files that A creates will be under TEST. However, he could created a folder 20130515 and under it to locate the newly created file. so it should be for any file and folder that is created recursively under TEST folder –  Odelya May 15 '13 at 18:59
default ACL's inherit to new subdirectories and apply to files created in those directories. So if you have /srv/TEST set the default ACL's on that directory then when the /srv/TEST/20130515 it will have the same default ACL's as the parent directory. –  Joel Davis May 15 '13 at 19:46

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.