0

I have a directory that has rwxrwxr-x and -s- permission settings, if I create files in this folder from user A these files gets permission rw-rw-r--, and with user B it gets rw-r--r--. I'm really confused about how exactly files are getting their permission set when they are first created...

To be more focused on what i need to do - the directory has group G which contains both users A and B and I want them both to be able to work on all the files in that same directory, so if both of them would have created files with rw-rw-r-- they could work on these files (delete them and recreate them or just edit them) without interference.

3

1 Answer 1

1

The permissions of a new file are set from (1) the permissions set in the open() call modified by (2) the umask of the creating process, so that bits set in the umask are zeroed. That is, a permission bit is set only if allowed by both of those, it's just that the bits in umask are inverted.

In your case the users probably have different umasks, namely A seems to have an umask of 0002 (clearing just the write bit from others), while B seems to have an umask of 0022 (clearing the write bit from the group and other users). The umasks are likely set in their shell startup files or via pam_umask.

If you have ACLs set on the directory, and default ACLs in particular, then the situation is slightly different. In that case, the umask is ignored, and instead the default ACLs are copied to ACLs on the file, except that only permission bits set in the system call stay set.

You're probably looking for the answers in this question:

You must log in to answer this question.

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