How to chmod ACLs to groups with spaces in the name on Mac OS X

access-control-listchmodmac-osx

I'm trying to add an ACL for the group "Domain Users", but since it has spaces in the group name it isn't parsed correctly by chmod:

$ chmod -R +a 'DOMAIN\Domain Users allow list,search,readattr,readextattr,readsecurity,file_inherit,directory_inherit' shared
Unable to translate 'DOMAIN\Domain' to a UID/GID

How do I escape the space? I've tried all the obvious approaches with single quotes, double quotes, and backslash.

Best Answer

Since Apple's source for chmod is available, there's a hint in the parser:

if (strchr(pebuf, ':')) /* User/Group names can have spaces */

And indeed, if you read the man page it says:

If the user or group name contains spaces you can use ':' as the delimiter between name and permission.

Thus the solution is:

$ chmod +a 'DOMAIN\Domain Users:allow list,search,readattr,readextattr,readsecurity,file_inherit,directory_inherit' shared
Related Topic