Create file/folder without inheriting parent group owner

Is there a way that I can create a file/folder without inheriting the group owner from the parent folder?

Example:
/tmp is owned by root:wheel
If user www creates a file/folder in /tmp then that new file/folder will have ownership www:wheel. I would like the new file to have ownership www:www.

I know that I can change the group permission with chown, but I don't wanna change the group on a unix socket every time the database server restarts.
 
Use a dedicated partition and use the gid mount option?
I was hoping for a system variable to change this behavior. Does your suggestion lock the group value for that mount point or just disable inherit of group ownership for that mount point?

Creating a subfolder and give that folder the group ownership I want so files and folders inherit that group value seams like a option.
Example:
mkdir /tmp/www && chown www:www /tmp/www
any files created inside /tmp/www would then inherit group www.
 
Inheriting group membership is the default in FreeBSD. See open(2).

I don't know why, and I find it quite annoying, because it's always been perfectly possible to explicitly arrange this behaviour on a directory using the setgid bit if you want it.

I don't know of a simple way to change this. There are a couple of workarounds suggested above.

Another is to create the file/folder in a directory you control which already has permanently assigned the group ownership you desire.

In your case, a chgrp(1) command added to the start/stop script might be the best option...
 
Back
Top