OS: Ubuntu 12.04
I have a directory what has given write permission to group foo
. Two users bar
and baz
are part of the group. Both can successfully write files to the directory. However, baz
cannot overwrite a file (i.e. create a file with the same name) that was written by bar
. I'm doing the file I/O through Python (csv module), but I don't think that has anything to do with this problem.
How do I set permissions so that bar
and baz
can overwrite eachother's files in the foo
directory?
Thanks.
When user creates file, the default permissions don't allow write to group. You need to change the
umask
so newly created files will have write permissions for group:To know what is the current umask, run it without args.
See man umask for more info.
You can change the mode of the directory to setgid to ensure that new files are created with the same group as that owning the directory. See this article for more information: http://en.wikipedia.org/wiki/Setuid .
The command is:
chmod g+s /path/to/directory