Unix – Overwriting a File Written by Another User in the Same Group

file-permissionsunix

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.

Best Answer

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

Related Topic