setfacl

Linux · Files · reference only

What it does

Sets or modifies the access control lists (ACLs) of files and directories, to grant permissions to specific users or groups.

Syntax

setfacl [opciones] entrada fichero...

Options and parameters

  • -m entrada

    Modifies or adds ACL entries, such as u:ana:rw.

  • -x entrada

    Removes specific ACL entries.

  • -b

    Removes all extended ACL entries.

  • -k

    Removes a directory's default ACL.

  • -d

    Applies the operations to the default ACL.

  • -R

    Applies the changes recursively.

  • -n

    Does not recalculate the ACL mask.

Usage examples

  • setfacl -m u:ana:rw informe.txt

    Gives ana read and write permission on the file.

  • setfacl -x u:ana informe.txt

    Removes ana's entry.

  • setfacl -d -m g:devs:rwx proyecto

    Makes new files in proyecto grant permissions to the devs group.

  • setfacl -b informe.txt

    Removes all extended ACLs and leaves the normal permissions.

Notes and common mistakes

  • The effective mask limits the permissions of named users and groups.
  • The file system must be mounted with ACL support.

Related commands