acl_copy_ext - Linux


Overview

acl_copy_ext is a command-line utility used to copy Access Control Lists (ACLs) between files and directories in extended ACL format. It provides finer-grained permissions management beyond the traditional user/group/other model.

Syntax

acl_copy_ext [-v] [-c] [-R] [-s] [-z octal-zeros] source-path... target-path

Options/Flags

  • -v: Enable verbose output, displaying detailed information about the ACL copy process.
  • -c: Copy ACLs recursively, extending the operation to subdirectories and files within the source.
  • -R: --rwx format flag. Convert the source ACL to rwx permissions when copying.
  • -s: --strip flag. Strip ACLs from the source files instead of copying them to the target.
  • -z octal-zeros: Set the number of zero ACL entries to preserve during the copy. Defaults to 3.

Examples

Copy ACLs from source.txt to target.txt:

acl_copy_ext source.txt target.txt

Copy ACLs recursively from /src to /dst:

acl_copy_ext -c /src /dst

Convert ACLs to rwx permissions before copying:

acl_copy_ext -R source.txt target.txt

Common Issues

  • Permission denied: Ensure you have sufficient permissions to read and write the source and target paths.
  • Invalid ACL: Verify that the ACLs on the source file are valid. Corrupted or malformed ACLs may cause errors during the copy process.

Integration

Combining with find to copy ACLs for specific files:

find /path -name '*.txt' -exec acl_copy_ext -c {} /target \;

Related Commands

  • getfacl: Retrieve file and directory ACLs.
  • setfacl: Set and modify file and directory ACLs.
  • acl: Manage Access Control Lists in a simplified text format.