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

  • You might be interested in this answer: stackoverflow.com/questions/3175303/…
    – Gavriel
    May 15, 2013 at 21:57
  • 2
    I don't want to do it from Java. This is not the right way to do it
    – Dejel
    May 16, 2013 at 4:41
  • "I don't want to do it from Java. This is not the right way to do it." That's almost a philosophical statement. It applies everywhere... Jun 29, 2016 at 16:53

1 Answer 1


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 : https://serverfault.com/questions/349145/can-i-override-my-umask-using-acls-to-make-all-files-created-in-a-given-director and https://stackoverflow.com/questions/580584/setting-default-permissions-for-newly-created-files-and-sub-directories-under-a.

  • 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
    – Dejel
    May 15, 2013 at 18:59
  • 2
    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.
    – Bratchley
    May 15, 2013 at 19:46
  • It might also be a good idea to run sudo chmod g+s [dir] so the files will be owned by the group
    – linuxgnuru
    May 19, 2018 at 20:19

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.