1

Say file.txt has the following permissions:

-rwxrw-r-- 1 chris group_b 347 2016-12-25 10:19 file.txt

The rw- are the permissions for the group in which file.txt belongs to.

Now let's say that Process A wants to access file.txt, the euid of Process A is paul (I am using names here instead of actual IDs).

Now (correct me if I'm wrong) each process has egid as well as a list of supplementary group IDs.

For example say that the egid for Process A is group_a and it has two supplementary group IDs, which are group_b and group_c.

This means that the process group permissions for file.txt (rw-) applies to Process A, correct?

Also, if Process A created a new file or a new directory, which group will the newly created file or directory belongs to (Process A has 3 groups), is it the egid?

2

This means that the process group permissions for file.txt (rw-) applies to Process A, correct?

Yes, correct.

Also, if Process A created a new file or a new directory, which group will the newly created file or directory belongs to (Process A has 3 groups), is it the egid?

Assuming that the directory the new file/directory is created into does not have its setgid bit set, yes.

If you want Process A to create its new files and directories with group group_b instead of the default group_a, you could start Process A with command sg group_b Process_A.

Or if a particular directory was designated for collaboration for group_c, then the owner of that directory could have set the group for that directory to group_c and then set the setgid bit for that directory:

mkdir /some/directory
chgrp group_c /some/directory
chmod g+rwxs /some/directory

Now, any new files and sub-directories created in that directory will automatically get their group ownership set to group_c. Any new sub-directories will inherit both the group ownership and the setgid bit, so this behavior will automatically propagate to any sub-directories and sub-sub-directories and so on as soon as they are created, unless the creator explicitly changes the group ownership or permissions.

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.