We have a shared Linux environment where most files are mounted to many machines on a NFSv3 share, which we do not control. Since we only have basic filesystem permissions available (No ACLs), we are looking for a way to allow people to run mkdir in a shared disk without giving the entire group write permissions over the root of the share.
For example, a binary with the setuid bit set, and the owner of the binary set to the owner of the share, could read a configuration file which would define which users or groups are allowed to create a directory in said shared directory. Then it could decide if the user that runs the binary is allowed to create a directory in the share.
The permissions on the top level share would be:
drwxr-x--- 1 owner group …
So the idea is that there is a wrapper for mkdir that then runs as the share owner, checks a configuration file, and creates the requested directory if the configuration file allows it. That way, the users can’t just run the built in mkdir.
The directory created would look something like this:
drwx------ 1 normaluser group 4096 Nov 3 18:14 newdir
Is this the best approach? Or are we reinventing the wheel?
setuidwould be very dangerous in a distributed setup.