Sunday, 6 December 2009

Inheriting group ownership for shared files

Use the SGID attribute to allow users to create files that can be opened by other users in their group.

When the SGID (Set Group Identification) attribute is set on a directory, files created in that directory inherit its group ownership. If the SGID is not set the file's group ownership will be set to the user's default group.

To set the SGID on a directory or to remove it, use the following commands:
chmod g+s directory
chmod g-s directory

When set, the SGID attribute is represented by the letter "s" which replaces the "x" in the group permissions:
ls -l public
drwxrwsr-x 10 brett users 4096 2009-012-10 17:40 public

No comments: