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

Enable shared write access via a folder action script System
This hint describes how to set up directories for shared write access among multiple users on a single machine using the user private group permissions model. It works very well for fixed files and folders, such as the iTunes or iPhoto libraries. With this scheme, any file or folder created within the shared folder heirarchy (including new photos, songs, etc.) will immediately be set up for shared write access.

However, moving pre-existing files to the shared folder does not set them up for shared write access: they keep the same permissions and ownership they already had -- i.e. they will likely have the user's private group, not the shared group, and thus not be writeable by the rest of the group. A quick trip to the Terminal can solve this, but it's not exactly a Mom and Pop type of solution.

A better solution to this is to attach a Folder Action script to a special folder which sets the group ownership and adds group write permission to whatever is added there. Note that this permanently modifies the files' group and group writeable property, and obviously only works when moving files in the Finder.

I'll refer to the shared directory as /Users/Shared, but it can be anywhere (and there may be good reasons for leaving /Users/Shared alone -- see the original hint for more info).

As an example of how you could use this folder action, you might have a EnableSharedWrite folder within the /Users/Shared/ hierarchy. To share write access on some pre-existing items, just drop your items into that folder to have their permissions changed, and then move them to a better location afterwards.

Just to be explicit, creating such a drop-box folder is easy:
% cd /path/to/shared_folder
% mkdir EnableSharedWrite
% chgrp home EnableSharedWrite
% chmod g+sw EnableSharedWrite
This will set up an EnableSharedWrite folder under your shared folder, and put it in the home group (fill in your shared group name, again as described in the original hint). Now attach this AppleScript as a folder action to that folder. Any members of the shared group can then drop things on it to set them up for sharing.

Just copy the script into Script Editor, and save as add - enable shared write into /Library/Scripts/Folder Action Scripts. In the Finder, Control-click on the drop-box folder you set up, enable folder actions, and attach this action. It will silently fail if the user isn't in the shared group or otherwise can't change the permissions, so be sure to check that it works before unleashing it on the in-laws.

Note that it is probably not a good idea to attach this script to the /Users/Shared folder directly, since it will be run for every new file created there (which is unnecessary). It's better used as a stopping off point to ensure any incoming files/folders have the proper permissions, before being situated somewhere else.

If you are creating files to be shared from scratch, just create them somewhere directly under /Users/Shared, and you are good to go; no intermediate drop-box step required. This is true even from the Terminal or X11 programs, since it just relies on standard Unix permissions behavior.

    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[13,510 views]  

Enable shared write access via a folder action script | 0 comments | Create New Account
Click here to return to the 'Enable shared write access via a folder action script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.