Spotlight
After the Circus

Random Sample
Summertime Flowers








contact me
jean at geemoo dot ca
Blog

Jul 18, 2008
I've been trying to find a nice solution for this problem for ages, and only recently discovered a kernel feature that gave me the hook that I needed. Here's the situation.

Imagine you have a bunch of users, and they need to share some files so they can co-operatively work on them.. fortunately not at the same time, but they will be uploading, downloading, editting, deleting.. and all of them need full access to all the files. The standard method of dealing with this is to configure every single access method they will be using, and set the umask to something that will make the group bits writable. And then you need to use chmod on the shared directory and make the group id sticky. All and all, I found this approach really messy and prone to breaking.

And then I found inotify. It's basically a structure that allows you to tap into filesystem events and then do stuff on them. There's a userland program called inotifywait that is used to interface with the kernel. This is what I based my script around. If interested, you can download it here [sharewatch.sh]. The script will watch for creation and attribute change events, and will then check the file or directory to make sure it is still group writeable, fixing it if it is not.

For now, it's a bash script, though eventually I will be rewriting this in C, once I find the time. Fixes and improvements are welcome.
Tags: linux