Simon Heimlicher

Simon Heimlicher's Homepage

Share Media Files Between All Users

The following procedure allows you to create a folder /Users/Shared/Media (referred to as the media folder) with special access control settings that have the following effect: Any file or folder that is copied into the media folder becomes available to any current and future users on the same Mac. This means that all users will be able to edit, move, rename, and delete the files and folders within the media folder.

Note

If you move a file or folder into the media folder, its permissions do not change. Therefore, you absolutely need to either copy items into the media folder or run the commands listed beneath adding existing items after moving the items (see below).

This is a slightly adapted version of this hint.

Here’s how to proceed:

Open the application Terminal. (Open Spotlight (the loupe symbol in the top right corner of the screen) and enter Terminal; wait until Terminal appears as the Top Hit and click on this.) Once Terminal is running, you’ll have an almost empty window with a cursor.

Enter the following sequence of commands (only the parts in the typewriter font); confirm each command with the Return key. You need to have administrative privileges for this to work and after the first command, you will be asked to enter your password. If it takes you more than a few minutes to complete the sequence of commands, you may be asked to enter your password again.

Create a new folder /Users/Shared/Media:

sudo mkdir -p /Users/Shared/Media

Make sure the folder is owned by the group staff, which is the group every user is a member of:

sudo chgrp -R staff /Users/Shared/Media

Finally, we enable the sharing of the contents of the folder and, very important, enable inheritance, such that any folder that is copied to the folder inherits those special permissions.

sudo chmod -R +a "group:staff allow delete,readattr,writeattr,readextattr,writeextattr,list,search,add_file,add_subdirectory,delete_child,execute,file_inherit,directory_inherit" /Users/Shared/Media

Verify if everything has worked:

ls -led /Users/Shared/Media/

This should show the following result:

drwxr-xr-x+ 4 root  staff  136 Nov 28 14:29 /Users/Shared/Media/

  0: group:staff allow list,add_file,search,delete,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,file_inherit,directory_inherit

Opening the Media Folder

If you have any existing files or folders which you want to share with everyone, put them into the media folder created above. To open the media folder, type:

open /Users/Shared/Media

The folder will now open in Finder and you can move any items into it that you want to share.

Once you are in Finder, to make access easier in the future, you may want to drag the media folder icon to your sidebar.

Adding Existing Items

If you have added any items to the media folder by moving them, you need to run the following two commands again:

sudo chgrp -R staff /Users/Shared/Media

sudo chmod -R +a "group:staff allow delete,readattr,writeattr,readextattr,writeextattr,list,search,add_file,add_subdirectory,delete_child,execute,file_inherit,directory_inherit" /Users/Shared/Media

As said above, if you save a file into the media folder, or you copy a file or folder into it, you do not need to run the above commands.

Comments