Set permissions for sharing only user through terminal

permissionsharingterminal

I am sharing my media folders on my local network by means of a sharing only user. The "sharing only" user is given read access to these folders, and anyone can connect with the user's log in credentials over smb in order to gain access to the files. However, when I add a new file to the shared folder, the sharing user does not have access to it, and I need to change the file permissions manually. I do this with finder by selecting folder info and reapplying the current read/write privileges to all enclosed items.

enter image description here

Are there any quicker methods for this procedure? Can it be done via terminal? Note that I cannot log into the shell as a sharing user. Can the read permissions be added automatically whenever a new file is added to the folder? Also, the machine in question is running Lion, so simple solutions are preferred.

Best Answer

I solved the probelm by setting the permissions in the following way:

sudo chmod -R +a "user:USER_NAME allow list,search,readattr,readextattr,readsecurity,file_inherit,directory_inherit" PATH_TO_DIRECTORY/

This does the trick of changing the folder permissions so it propagates the users permissions automatically when new files are added. In this example

allow list,search,readattr,readextattr,readsecurity

are copied from the permissions of the sharing only user, and I have added

file_inherit,directory_inherit

in order to allow the files and directories within the original directory to automatically inherit the permissions.