How do I copy ACLs on Mac OS X?

Posted by MagerValp on Server Fault See other posts from Server Fault or by MagerValp
Published on 2010-09-17T13:48:09Z Indexed on 2011/11/30 17:58 UTC
Read the original article Hit count: 165

Filed under:
|
|

Most unix derivates can copy ACLs from one file to another with:

getfacl filename1 | setfacl -f - filename2

Unfortunately Mac OS X does not have the getfacl and setfacl commands, as they have rolled ACL handling into chmod. chmod -E accepts a list of ACLs on stdin, but I haven't found a command that will spit out ACLs in a suitable format on stdout. The best I have come up with is:

ls -led filename1 | tail +2 | sed 's/^ *[0-9][0-9]*: *//' | chmod -E filename2

Is there a more robust solution?

Bonus question: is there a nice way to do it in Python, without using any modules that aren't shipped with 10.6?

© Server Fault or respective owner

Related posts about macosx

Related posts about acl