System Administration Guide

How to Add or Modify ACL Entries on a File

  1. Add or modify ACL entries on a file by using the setfacl command.


    $ setfacl -m acl_entry_list filename1 [filename2...]
    -m

    Modifies the existing ACL entry. 

    acl_entry_list

    List of one or more ACL entries to add or modify on the file or directory. You can also add or modify default ACL entries on a directory. Table 51-9 and Table 51-10 show the valid ACL entries.

    filename ...

    File or directory on which to add or modify ACL entries. 

  2. To verify that the ACL entries were added or modified on the file, use the getfacl command.


    $ getfacl filename
    

Examples--Adding or Modifying ACL Entries on a File

The following example adds read/write permissions for the user george on the ch3.doc file.


$ setfacl -m user:george:6 ch3.doc
getfacl ch3.doc
# file: ch3.doc
# owner: george
# group: staff
user::rw-				
user::george:rw-				#effective:rw-
group::r-						#effective:r--
mask:r--
other:r--

The following example adds default ACL entries for the book directory, which already has a default entry specified for the owner of the directory, for the group owner of the directory, and for others. The users in the staff group are given read permissions and the required default mask is set to read/write.


$ setfacl -m default:group:staff:4,default:mask:6 book
getfacl book