1

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.

2 Answers 2

0

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

0

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:

umask 0002

To know what is the current umask, run it without args.

See man umask for more info.

3
  • Thanks @shimon! I just ran umask in the foo directory with no args, it returned 0002
    – NP01
    Feb 12, 2013 at 7:33
  • AFAIK, You set it once and it persists until you change it.. Feb 12, 2013 at 7:34
  • umask only limits the max permissions so if the application doesn't request group write then umask has no effect.
    – user9517
    Feb 12, 2013 at 7:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .