I have a group of developers who want to share the same directory. I created a new group with these developers and created a directory for them. On that directory, I set the group to the group I created and set the setgid bit.

And that all works great... files and directories that are created inside this shared directory have the right permissions. But the developers use an application that is doing something that results in unexpected permissions. Instead of files and directories being created with the group of the shared directory, they have the group of the user. And on directories, the setgid bit isn't set.

My guess as to what is happening is the application is creating a directory hierarchy someplace else (such as /tmp) and when it's done, it's moving that to the shared directory. If it isn't that it's something like that. My solution so far is to manually adjust the permissions; I search for files and directories that don't have the right permissions with find and then pipe that list into xargs. And since this is a constant problem, I'll probably use super to give the developers a way to fix up the permissions themselves.

Is there a better solution?


1 Answer 1


Hi and welcome to StackExchange.

Your hypothesis for for how this is happening sounds reasonable, but you really need to confirm that is the source of the problem.

If you find that it is, actually, the cause of the issue, then I would suggest you look into configuring the application to create temp directories inside the shared directory.

If that's not possible an alternative might be to find where in /tmp the directories are being created (they're probably named by the username or userid of the person running the application to prevent collisions) and symlink that into the shared directory.

Alternatively, you might try changing the group of the executable the devs are using to that of the shared directory and then set the setgid bit on the excutable. That would cause the application to run as the shared group id and, barring the executable doing something specific, should result in directories created by that application to have the group of the running process.

Finally, the least attractive solution would be to set up a cronjob to run on a cadence to update the permissions in the shared directory.

You must log in to answer this question.

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