Skip to main content

Extended Attributes and ACLs on MacOS X

The last article on this topic covered Linux systems, let's see how things are on MacOS X:

EA - Extended attributes


Extended attributes (arbitrary name/value pairs) are marked with an @ sign on the command line:
$ ls -l .DS_Store 
-rw-------@  1 bob  staff     24580 Aug  7 01:04 .DS_Store

$ xattr -l .DS_Store 
com.apple.FinderInfo:
00000000  20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00  |        ........|
00000010  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
00000020

$ xattr -p com.apple.FinderInfo .DS_Store 
20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

$ xattr -d com.apple.FinderInfo .DS_Store 
With the last command, we removed the extended attribute from the file. But there's more:

ACLs - Access Control Lists


With the EA removed, a plus-sign (+) appears, marking Access Control Lists. They can be shown with ls(1) and changed with chmod(1):
$ ls -l .DS_Store 
-rw-------+ 1 bob  staff  24580 Aug  7 01:04 .DS_Store

$ ls -le .DS_Store 
-rw-------+ 1 bob  staff  24580 Aug  7 01:04 .DS_Store
 0: group:everyone deny delete
Somehow this ACL was set for many (all?) files in my home directory and it was impossible to delete files w/o entering the admin password first. Removing the ACL helped:
$ rm -f .DS_Store
rm: .DS_Store: Permission denied

$ chmod -a "group:everyone deny delete" .DS_Store

$ ls -le .DS_Store
-rw-r--r--- 1 bob  staff  24580 Aug  7 01:04 .DS_Store
Deleting this ACL from all objects in $HOME with chmod -R helped indeed and deleting files is now possible again, w/o being asked for a password.