acl_set_file - Linux


acl_set_file is a command-line tool for manipulating Access Control Lists (ACLs) of files and directories in Linux systems. It allows administrators to grant or revoke permissions to specific users or groups for accessing, modifying, or owning files and directories.


acl_set_file [-f] [-a] [-b] [-d] [-e] [-n] [-p] [-s] [-t] [-v] <ACL> <FILE>


  • -f: Forcefully set ACLs, even if they are inherited.
  • -a: Add ACL entries without removing existing ones.
  • -b: Purge all ACL entries before setting new ones.
  • -d: Remove ACL entries matching a given ACL entry.
  • -e: Set ACL entries only if the file or directory exists.
  • -n: Do not perform any changes, only show what would be done.
  • -p: Set permissions (r, w, x) for the given ACL entry.
  • -s: Set owner user or group for the given ACL entry.
  • -t: Only set ACL entries that match a given type (user, group, mask, or other).
  • -v: Verbose output, show all ACL entries affected by the command.


Adding an ACL entry to a file:

acl_set_file -a user:bob:rw /path/to/file

Removing an ACL entry from a directory:

acl_set_file -d user:alice /path/to/directory

Setting permissions for a specific user and group:

acl_set_file -p user:bob:rw group:developers:rwx /path/to/file

Common Issues

  • Permission denied: Ensure that the user running the command has sufficient permissions to modify ACLs for the target file or directory.
  • Invalid ACL entry: The specified ACL entry should be in a valid format (e.g., user:username:permissions).
  • File or directory not found: Verify that the target file or directory exists and is accessible.


acl_set_file can be used in conjunction with other Linux commands, such as:

  • find: To search for files or directories with specific ACLs.
  • grep: To filter ACL entries based on specific criteria.
  • sed: To modify ACL entries using regular expressions.
  • xargs: To apply ACL modifications to multiple files or directories simultaneously.

Related Commands

  • getfacl: Displays ACLs of files and directories.
  • setfacl: Sets ACLs of files and directories.
  • chmod: Changes file or directory permissions.
  • chown: Changes file or directory ownership.