MacOS – How to give access to the user and _www

macospermission

I am new to mac and running a website through apache server.
The code for my application is being accessed by the _www user, so I set the ownership to _www user but then when I try to edit a file from netbeans I have to give the ownership back to my user.
I dont want to use the my application or netbeans from the root user but is there a way I can give permission to both myuser and _www user to a directory?

Thanks!

Best Answer

To give a user or a group full access to a folder use

chmod +a "user_name allow list,add_file,search,delete,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,writesecurity,chown,file_inherit,directory_inherit" /path/to/folder

You may replace user_name by a group_name.

To remove the ACL simply replace the +a by -a.

It's similar for a single file - the attributes are different though:

chmod +a "user_name allow read,write,execute,delete,append,readattr,writeattr,readextattr,writeextattr,readsecurity,writesecurity,chown" /path/to/file

Insert a -R for all files in a folder:

chmod -R +a "user_name allow read,...