Setfacl (1) Access Control lists Setfacl (1)
NAME
setfacl-set file access control Lists
Synopsis
Setfacl [-bkndrlpvh] [{-m|-x} Acl_spec] [{-m|-x} Acl_file] file ...
#注意参数的使用顺序
Setfacl--restore=file
DESCRIPTION
This utility sets Access Control Lists (ACLs) of files and directories. On the command line, a sequence of commands are followed by a
Sequence of files (which in turn can is followed by another sequence of commands, ...).
The options-m, and-x expect an ACL on the command line. Multiple ACL entries is separated by comma characters (', '). The Options-m, and
-X read an ACL from a file or from standard input. The ACL entry format is described in a section ACL ENTRIES.
The--set and--set-file options set the ACL of a file or a directory. The previous ACL is replaced. ACL entries for this operation must
Include Permissions.
The-m (--modify) and-m (--modify-file) options Modify the ACL of a file or directory. ACL entries for this operation must include Permis‐
Sions.
The-x (--remove) and-x (--remove-file) options remove ACL entries. It is not a error to remove an entry which does not exist. Only ACL
Entries without the Perms field is accepted as parameters, unless posixly_correct is defined.
When reading from files using the-m, and-x options, Setfacl accepts the output GETFACL produces. There is at the most one ACL entry per line.
After a Pound sign (' # '), everything the end of the line is treated as a comment.
If Setfacl is used on a file system which does not support ACLs, SETFACL operates on the file mode permission bits. If the ACL does not fit
Completely in the permission bits, Setfacl modifies the file mode permission bits to reflect the ACL as closely as Possibl E, writes an error
Message to standard error, and returns with an exit status greater than 0.
PERMISSIONS
The file owner and processes capable of cap_fowner is granted the right to modify ACLs of a file. This was analogous to the permissions
Required for accessing the file mode. (on current Linux systems, Root was the only user with the Cap_fowner capability.)
OPTIONS
-M,--modify=acl change the access control list for a file
-M,--modify-file=file Read access control list entry change from file
-X,--remove=acl removes entries based on the Access control list in the file
-X,--remove-file=file reads the access control list entry from the file and deletes
-B,--remove-all
Remove all extended ACL entries. The base ACL entries of the owner, group and others are retained.
#删除所有的ACL参数
-K,--remove-default
Remove the Default ACL. If no Default ACL exists, no warnings is issued.
#删除默认的ACL参数
-R,--recursive
Apply operations to all files and directories recursively. This option cannot is mixed with '--restore '.
-L,--logical
Logical Walk, follow symbolic links to directories. The default behavior is to follow symbolic link arguments, and skip symbolic links
Encountered in subdirectories. Only effective in combination with-r. This option cannot is mixed with '--restore '.
-P,--physical
Physical walk, do not follow symbolic links to directories. This also skips symbolic link arguments. Only effective in combination
With-r. This option cannot is mixed with '--restore '.
-N,--no-mask
Do not recalculate the effective rights mask. The default behavior of Setfacl is to recalculate the ACL mask entry, unless a mask entry
was explicitly given. The mask entry is set to the union of all permissions of the owning group, and all named user and group entries.
(These is exactly the entries affected by the mask entry).
--mask
Do recalculate the effective rights mask, even if a ACL mask entry was explicitly given. (see The-n option.)
-D,--default
All operations apply to the Default ACL. The Regular ACL entries in the input set is promoted to the Default ACL entries. Default ACL Entries
In the input set is discarded. (A warning is issued if, happens).
--restore=file
Restore a permission backup created by ' Getfacl-r ' or similar. All permissions of a complete directory subtree is restored using this
mechanism. If The input contains owner comments or group comments, Setfacl attempts to restore the owner and owning group. If the input
Contains flags comments (which define the setuid, setgid, and sticky bits), Setfacl sets those three bits accordingly; Otherwise, it
Clears them. This option cannot is mixed with other options except '--test '.
--test
Test mode. Instead of changing the ACLs of any files, the resulting ACLs is listed.
-V,--version
Print the version of Setfacl and exit.
-H,--help
Print help explaining the command line options.
--End of command line options. All remaining parameters is interpreted as file names, even if they start with a dash.
-If The file name parameter is a single dash, Setfacl reads a list of files from standard input.
ACL ENTRIES
The Setfacl utility recognizes the following ACL entry formats (blanks inserted for clarity):
[D[efault]:] [u[ser]:]uid [:p erms]
Permissions of a named user. Permissions of the file owner if UID is empty.
[D[efault]:] g[roup]:gid [:p erms]
Permissions of a named group. Permissions of the owning group if GID is empty.
[D[efault]:] m[ask][:] [:p erms]
Effective Rights Mask
[D[efault]:] o[ther][:] [:p erms]
Permissions of others.
Whitespace between delimiter characters and non-delimiter characters is ignored.
Proper ACL entries including permissions is used in modify and set operations. (Options-m,-M,--set and--set-file). Entries without the
Perms field is used for deletion of entries (Options-x and-x).
For the UID and GID you can specify either a name or a number.
The Perms field is a combination of characters that indicate the Permissions:read (R), write (W), execute (x), execute O nly if the file is
A directory or already has an EXECUTE permission for some user (X). Alternatively, the Perms field can be a octal digit (0-7).
Automatically CREATED ENTRIES
Initially, files and directories contain only the three base ACLs entries for the owner, the group, and others. There is some rules that
Need to being satisfied in order for the ACL to is valid:
* The three base entries cannot be removed. There must is exactly one entry of each of the these base entry types.
* Whenever an ACL contains named user entries or named group objects, it must also contain an effective rights mask.
* Whenever an ACL contains any default ACL entries, the three default ACL base entries (default owner, default group, a nd default others)
must also exist.
* Whenever a default ACL contains named user entries or named group objects, it must also contain a default effective RI Ghts Mask.
To help the user ensure these rules, Setfacl creates entries from existing entries under the following conditions:
* If An ACL contains named user or named group entries, and no mask entry exists, a mask entry containing the same PE Rmissions as the
Group entry is created. Unless the-n option is given, the permissions of the mask entry be further adjusted to include the Union of
All permissions affected by the mask entry. (see the-n option description).
* If A default ACL entry is created, and the default ACL contains no owner, owning group, or others entry, a copy of the ACL owner, owning
Group, or others entry is added to the Default ACL.
* If a Default ACL contains named user entries or named group entries, and no mask entry exists, a mask entry containin G The same permis‐
Sions as the default default ACL ' s group entry is added. Unless the-n option is given, the permissions of the mask entry is further
Adjusted to inclu de the union of all permissions affected by the mask entry. (see the-n option description).
EXAMPLES
Granting an additional user read access
Setfacl-m u:lisa:r File
Revoking write access from all groups and all named users (using the effective rights mask)
Setfacl-m M::rx File
Removing a named group entry from a file ' s ACL
Setfacl-x G:staff File
Copying the ACL of one file to another
Getfacl File1 | Setfacl--set-file=-File2
Copying the access ACL into the Default ACL
Getfacl--access dir | Setfacl-d-m-dir
Conformance to POSIX 1003.1e DRAFT standard 17
IF the environment variable posixly_correct is defined, the default behavior of Setfacl changes as Follows:all non-st Andard options are
Disabled. The ' default: ' prefix is disabled. The-x and-x options also accept permission fields (and ignore them).
AUTHOR
Andreas Gruenbacher, <[email protected]>
Please send your bugs reports, suggested features and comments to the above address.
See ALSO
Getfacl (1), chmod (1), umask (1), ACL (5)
May/ACL File Utilities Setfacl (1)
Linux--Setfacl