Question

I have a folder xyz with root as its user and abc as its group. I have say 3 users, a, b, c who belong to the group abc. The folder has permission as 775, which means any user in the group can write into the folder.

The problem I am having is, when say, user a uploads a file in the folder xyz, the file has a as its user and as its group as well. Which means, user b will bot be able to edit the file.

So what can we do to ensure that any new file which gets uploaded in the folder xyz has by default abc as its group name?

Was it helpful?

Solution

Set the setgid bit on the directory. Newly created files will inherit the group of the directory rather than the primary group of the user creating the file.

chmod g+s /path/to/xyz
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top