How to add a second owner of a folder using terminal on Mac

chownosxpermissionsterminal

On Mac using terminal and "chown" command I can set owner for a folder like this:

sudo chown -R _www somefolder

However this replaces me with _www.
I.e. I'm not in the list of owners anymore.

enter image description here

I then have to open folder properties in Finder, add myself as a second owner and set permissions using the GUI.

enter image description here

And this is what the ACL looks like:

enter image description here

Is there a way to add TWO owners using terminal?
In other words how to add a second owner to a folder using terminal?
Not necessarily chown.

PS: Just in case.. on the screenshots users "_www" and "Oleg (Я)" have permissions "Read and write".

Best Answer

Found the answer (type this in Terminal):

sudo chmod +a 'Oleg allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity' somefolder

Where 'Oleg' is a user name and 'somefolder' is a folder name in question.

The permissions inside single quotes after the 'allow' keyword are just copied from the output of ls -le

Now both users '_www' and 'Oleg' can read, write files and subdirectories, etc.

That was the intention.

Strictly speaking yes, you can not add a second "owner" in POSIX attributes sense, e.g. via Chown.

However in Mac you can give owner-like permissions to numerous users via ACL like Philippos commented (thanks for hinting).

Related Question