10.5: Share any files between users on the same Mac

Jun 04, '09 07:30:02AM

Contributed by: Anonymous

10.5: For a long time now, I've wished that there was a way in OS X to create a shared folder which disregarded file permissions. In particular, I want all the users to be able to read and write to all the files in the shared folder. This is very useful to me, because I want to have only library for each of iTunes, iPhoto and Aperture, and share those libraries between all the users on my Mac.

I've tried many different things, but they were either too hacky or they just didn't work as advertised. I've come up with the following method which works, is safe, is not a hack, and is easy to implement. The secret to this technique is to use Access Control Lists (ACLs). The procedure is as follows:

  1. Create a new group. The easiest way to do this is through the Accounts pane in System Preferences. Just click on the Plus sign to add a new account and then select Group from the New Account drop-down menu. Call this group anything you want; I called mine friday. Add all the users who you want to participate in the file sharing to your newly-created group.
  2. Do the following steps in Terminal, in Applications -> Utilities:
    1. cd into the /Users/Shared directory: cd /Users/Shared.
    2. Create a new folder where the users will be able to share their files. I created a folder named Friday by typing mkdir Friday.
    3. Change the group of the new folder to your newly-created group: sudo chown admin:friday Friday.
    4. Change the default permissions, if you wish: sudo chmod 770 Friday (this is optional if you're happy with the default permissions).
    5. Create the ACL entry for the new folder:
      sudo chmod +a "group:friday allow delete,readattr,writeattr,readextattr,writeextattr,list,search,add_file,add_subdirectory,delete_child,file_inherit,directory_inherit" Friday
You now have a folder where all members of the group friday can read, write and delete files, as well as read, write to and create new sub folders. The ACL rule takes precedence over standard UNIX file permissions and is automatically inherited. It's this automatic inheritance that is really important.

Now you are ready to copy your iTunes, Aperture, iPhoto libraries, plus anything else you want to share, into the shared folder. IMPORTANT: You must copy (hold down Option in Finder prior to dragging), and not merely move, items. This is particularly important with bundles, such as the Aperture library bundle for example. Moving items doesn't seem to always inherit the correct ACL rules. Copying ensures that the files are actually created in the shared folder, thereby forcing the ACL rules to be inherited.

[robg adds: This hint has been in the queue for a while -- I had tagged it as something I wanted to try with our shared iMac, then basically forgot about it. My apologies for not publishing it sooner. We've run similar hints for related subjects in the past, but this method seems reasonably simple and easy to understand. I still, of course, haven't tested it yet.]

Comments (46)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20090219133314985