setfacl
Sets Access Control Lists (ACLs) of files and directories.
Returns 0
on success and non-zero on error.
The usage is as follows:
$ hadoop fs -setfacl [-R] [-b
|-k -m |-x <acl_spec> <path>] |[--set <acl_spec> <path>]
-b |
Removes everything, but the base ACL entries. The entries for user, group, and others are retained for compatibility with permission bits |
-k |
Removes the default ACL |
-R |
Applies operations to all files and directories recursively |
-m |
Modifies ACL. New entries are added to the ACL, and existing entries are retained |
-x |
Removes specified ACL entries. Other ACL entries are retained |
--set |
Fully replaces the ACL, discarding all existing entries. The |
acl_spec |
A comma-separated list of ACL entries |
path |
A path to the file or directory to modify |
Example:
$ hadoop fs -setfacl -m user:hadoop:rw- /file
$ hadoop fs -setfacl -x user:hadoop /file
$ hadoop fs -setfacl -b /file
$ hadoop fs -setfacl -k /dir
$ hadoop fs -setfacl --set user::rw-,user:hadoop:rw-,group::r--,other::r-- /file
$ hadoop fs -setfacl -R -m user:hadoop:r-x /dir
$ hadoop fs -setfacl -m default:user:hadoop:r-x /di