Getting ACLs
Command String
Get ACL getfacl file.txt
Get Default ACL getfacl -d file.txt
Get ACL without comment getfacl -c file.txt
Get ACL in tabular format getfacl --tabular file.txt
Get ACLs recursively getfacl -R /home/share
Get ACLs and show UID and GID getfacl --numeric file.txt
Setting ACLs
Command String
Modify ACL setfacl -m user:bob:rwx file.txt
Modify ACL – short form setfacl -m u:bob:rwx file.txt
Modify multiple ACLs setfacl -m user:bob:rwx,user:rob:r file.txt
Modify Group ACL setfacl -m group:wheel:rwx file.txt
Modify Default ACL on dir setfacl -d -m group:wheel:rwx /home/share
Removing ACLs
Command String
Remove ACL setfacl -x user:bob,user:rob file.txt
Remove Default ACL setfacl -k /home/share
Remove all ACLs setfacl -b file.txt
Interesting Uses for ACLs
Command String
Copy ACL from one file1 to file2 getfacl file.txt | setfacl --set-file=- file.bak
Save ACL to a config file getfacl -c file.txt > shareacls.txt
Set ACLs from a config file setfacl -M shareacls.txt /home/share/*
Copy ACL to Default getfacl /home/share/ | setfacl -d -M- /home/backup/
Revoke write access to all users/groups setfacl -m m::rx file
Copy/Preserve ACLs
Command String
Copy files with ACLs cp -p /home/share/file.txt /home/backup/
Archive files with ACLs tar --acls -czvpf archive.tar.gz /home/share/
Get ACL Tree and store in file getfacl -R /home/share/ > Tree.facl
Restore ACL Tree setfacl --restore Tree.facl