Computer Hope

Other Pages

Home
Site map
Computer help

Dictionary
News
Q&A
What's new

Tools

E-mail this page
Print Preview
Edit this page



 

Linux / Unix setfacl command

Quick links

About setfacl
Syntax
Examples
Related commands
Linux / Unix main page

About setfacl

Modify the Access Control List (ACL) for a file or files.

Syntax

setfacl [-r] [-f] [-d] [-m] [-s] [aclfile]

-r Recalculate the permissions for the ACL mask
entry. The permissions specified in the ACL mask
entry are ignored and replaced by the maximum per-
missions necessary to grant the access to all
additional user, file group owner, and additional
group entries in the ACL. The permissions in the
additional user, file group owner, and additional
group entries are left unchanged.
-f Set a file's ACL with the ACL entries contained in the file named acl_file. The same constraints on  specified entries hold as with the -s option. The entries are not required to be in any specific order in the file. Also, if you specify a dash '-' for acl_file, standard input is used to set the file's ACL. 

The character "#" in acl_file may be used to indicate a comment. All characters, starting with the "#" until the end of the line, will be ignored.  Note that if the acl_file has been created as the output of the getfacl(1) command, any effective permissions, which will follow a "#", w ill be ignored.

-d Delete one or more entries from the file. The entries for the file owner, the file group owner, and others may not be deleted from the ACL. Note that deleting an entry does not necessarily have  the same effect as removing all permissions from the entry.
-m Add one or more new ACL entries to the file, and/or modify one or more existing ACL entries on the file. If an entry already exists for a specified uid or gid, the specified permissions will replace the current permissions. If an entry does not exist for the specified uid or gid, an entry will be created.
-s Set a file's ACL. All old ACL entries are removed and replaced with the newly specified ACL. The entries need not be in any specific order. They will be sorted by the command before being applied to the file. 

Required entries:

  • Exactly one user entry specified for the file owner.
  • Exactly one group entry for the file group owner.
  • Exactly one other entry specified.

If there are additional user and group entries:

  • Exactly one mask entry specified for the ACL mask that indicates the maximum permissions allowed for users (other than the owner) and groups.
  • Must not be duplicate user entries with the same uid.
  • Must not be duplicate group entries with the same gid.

If file is a directory, the following default ACL entries may be specified:

  • Exactly one default user entry for the file owner. 
  • Exactly one default group entry for the file group owner.
  • Exactly one default mask entry for the ACL mask.
  • Exactly one default other entry.

There may be additional default user entries and additional default group entries specified, but there may not be duplicate additional default user entries with the same uid, or duplicate default group entries with the same gid.

aclfile  

Examples

setfacl -m user:hope:r-- myfile.txt - Adds one ACL entry to the file myfile.txt, which gives the user hope read permission only.

Related commands

getfacl
umask

 

Index

Category:
Linux / Unix

Companies:
Click here

Related Pages:

 

Resolved

Were you able to locate the answer to your questions?

Home - Computer help - Contact - Dictionary - Links
Link to Computer Hope - Bookmark Computer Hope