Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Allow shared write access to any directory' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Allow shared write access to any directory
Authored by: jdsmith on Jan 11, '06 12:38:19PM
I've had a few questions on this hint and thought I'd offer some further clarification:

The umask is a subtractive permission from 777, where "7" means 1(=read) + 2(=write) + 4(=execute). And the three digits are for user/group/others in that order. So, a umask of 002 means files have default permissions 775, or user rwx, group rwx, others r-x. Note that whether the execute bit actually gets set for new files is actually not entirely determined by umask. It is usually not (except for directories), which is the correct behavior.

As for the UPG scheme, umask of 002 and 022 are exactly the same, since by default you are the only member in your group, so it doesn't matter if you give group write access. In this sense, Apple implemented half of the UPG scheme (all users get their own private group), which isn't too useful by itself.

It's vital that the setgid bit be set on directories and subdirectories which you want to share. Once you do this, you don't have to worry anymore: all nested directories created there later will be fine. If you want to check, try this:

% cd /path/to/shared_dir
% find . \! -perm -g=w -exec ls -ld \{} \;

which will show any files which don't have group writeability. Do notice the backslashes!

Important: Please note that simply moving files/folders to a shared directory does not alter their permissions or group ownership, so if you have existing files you'd like to share, you must set their group ownership (and possibly permissions, if they were created elsewhere or before your umask took effect) by hand. For importing pre-existing files/directories, you must use chgrp and chown as shown above for the iPhoto Library on them.

Actually, this is probably a common case: create a file in your Documents directory, and then later decide you want to let others edit it to, so drop it into /Users/Shared. Without explicitly setting ownership, or a folder action, this won't work. A useful folder action would chgrp -R parentdirectorygroup and chmod -R g+w the incoming file/folder, where parentdirectorygroup is the shared group name of the parent directory (or you could just hardcode it).

Disk Utility "Repair Permissions" does not affect user directories, so can be used freely without worrying about breaking your sharing scheme.

[ Reply to This | # ]

Allow shared write access to any directory
Authored by: Han Solo on Jan 11, '06 04:56:52PM
Do notice the backslashes!

I suspect GeekLog ate your backslashes in the find command you posted. You should try again, without using the code tages this time....

[ Reply to This | # ]

Allow shared write access to any directory
Authored by: jdsmith on Jan 11, '06 10:27:56PM
I'll figure this out eventually:
% find . ! -perm -g=w -exec ls -ld \{} \;


[ Reply to This | # ]