2 .\" Copyright (c) 2001 Chris D. Faulhaber
3 .\" Copyright (c) 2011 Edward Tomasz NapieraĆa
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .Nd set ACL information
35 .Op Fl R Op Fl H | L | P
37 .Op Fl a Ar position entries
40 .Op Fl x Ar entries | position
46 utility sets discretionary access control information on
47 the specified file(s).
48 If no files are specified, or the list consists of the only
50 the file names are taken from the standard input.
52 The following options are available:
53 .Bl -tag -width indent
54 .It Fl a Ar position entries
55 Modify the ACL on the specified files by inserting new
62 This option is only applicable to NFSv4 ACLs.
64 Remove all ACL entries except for the ones synthesized
65 from the file mode - the three mandatory entries in case
67 If the POSIX.1e ACL contains a
69 entry, the permissions of the
71 entry in the resulting ACL will be set to the permission
72 associated with both the
76 entries of the current ACL.
78 The operations apply to the default ACL entries instead of
80 Currently only directories may have
82 This option is not applicable to NFSv4 ACLs.
84 If the target of the operation is a symbolic link, perform the operation
85 on the symbolic link itself, rather than following the link.
89 option is specified, symbolic links on the command line are followed
90 and hence unaffected by the command.
91 (Symbolic links encountered during tree traversal are not followed.)
93 Delete any default ACL entries on the specified files.
95 is not considered an error if the specified files do not have
96 any default ACL entries.
97 An error will be reported if any of
98 the specified files cannot have a default entry (i.e.,
100 This option is not applicable to NFSv4 ACLs.
104 option is specified, all symbolic links are followed.
106 Modify the ACL on the specified file.
107 New entries will be added, and existing entries will be modified
111 For NFSv4 ACLs, it is recommended to use the
117 Modify the ACL entries on the specified files by adding new
118 ACL entries and modifying existing ACL entries with the ACL
119 entries specified in the file
125 the input is taken from stdin.
127 Do not recalculate the permissions associated with the ACL
129 This option is not applicable to NFSv4 ACLs.
133 option is specified, no symbolic links are followed.
136 Perform the action recursively on any specified directories.
137 When modifying or adding NFSv4 ACL entries, inheritance flags
138 are applied only to directories.
139 .It Fl x Ar entries | position
142 is specified, remove the ACL entries specified there
143 from the access or default ACL of the specified files.
144 Otherwise, remove entry at index
148 Remove the ACL entries specified in the file
150 from the access or default ACL of the specified files.
153 The above options are evaluated in the order specified
155 .Sh POSIX.1e ACL ENTRIES
156 A POSIX.1E ACL entry contains three colon-separated fields:
157 an ACL tag, an ACL qualifier, and discretionary access
159 .Bl -tag -width indent
161 The ACL tag specifies the ACL entry type and consists of
162 one of the following:
166 specifying the access
167 granted to the owner of the file or a specified user;
171 specifying the access granted to the file owning group
172 or a specified group;
176 specifying the access
177 granted to any process that does not match any user or group
182 specifying the maximum access
183 granted to any ACL entry except the
185 ACL entry for the file owner and the
188 .It Ar "ACL qualifier"
189 The ACL qualifier field describes the user or group associated with
191 It may consist of one of the following: uid or
192 user name, gid or group name, or empty.
195 ACL entries, an empty field specifies access granted to the
199 ACL entries, an empty field specifies access granted to the
204 ACL entries do not use this field.
205 .It Ar "access permissions"
206 The access permissions field contains up to one of each of
212 to set read, write, and
213 execute permissions, respectively.
214 Each of these may be excluded
217 character to indicate no access.
222 ACL entry is required on a file with any ACL entries other than
231 option is not specified and no
233 ACL entry was specified, the
238 ACL entry consisting of the union of the permissions associated
241 ACL entries in the resulting ACL.
243 Traditional POSIX interfaces acting on file system object modes have
244 modified semantics in the presence of POSIX.1e extended ACLs.
245 When a mask entry is present on the access ACL of an object, the mask
246 entry is substituted for the group bits; this occurs in programs such
251 When the mode is modified on an object that has a mask entry, the
252 changes applied to the group bits will actually be applied to the
254 These semantics provide for greater application compatibility:
255 applications modifying the mode instead of the ACL will see
256 conservative behavior, limiting the effective rights granted by all
257 of the additional user and group entries; this occurs in programs
261 ACL entries applied from a file using the
265 options shall be of the following form: one ACL entry per line, as
266 previously specified; whitespace is ignored; any text after a
268 is ignored (comments).
270 When POSIX.1e ACL entries are evaluated, the access check algorithm checks
271 the ACL entries in the following order: file owner,
273 ACL entries, file owning group,
279 Multiple ACL entries specified on the command line are
282 It is possible for files and directories to inherit ACL entries from their
284 This is accomplished through the use of the default ACL.
285 It should be noted that before you can specify a default ACL, the mandatory
286 ACL entries for user, group, other and mask must be set.
287 For more details see the examples below.
288 Default ACLs can be created by using
290 .Sh NFSv4 ACL ENTRIES
291 An NFSv4 ACL entry contains four or five colon-separated fields: an ACL tag,
292 an ACL qualifier (only for
296 tags), discretionary access permissions, ACL inheritance flags, and ACL type:
297 .Bl -tag -width indent
299 The ACL tag specifies the ACL entry type and consists of
300 one of the following:
304 specifying the access
305 granted to the specified user;
309 specifying the access granted to the specified group;
311 specifying the access granted to the owner of the file;
313 specifying the access granted to the file owning group;
318 is not the same as traditional Unix
321 literally, everyone, including file owner and owning group.
322 .It Ar "ACL qualifier"
323 The ACL qualifier field describes the user or group associated with
325 It may consist of one of the following: uid or
326 user name, or gid or group name.
327 In entries whose tag type is one of
332 this field is omitted altogether, including the trailing colon.
333 .It Ar "access permissions"
334 Access permissions may be specified in either short or long form.
335 Short and long forms may not be mixed.
336 Permissions in long form are separated by the
338 character; in short form, they are concatenated together.
339 Valid permissions are:
340 .Bl -tag -width ".Dv modify_set"
373 In addition, the following permission sets may be used:
374 .Bl -tag -width ".Dv modify_set"
378 all permissions, as shown above
380 all permissions except write_acl and write_owner
382 read_data, read_attributes, read_xattr and read_acl
384 write_data, append_data, write_attributes and write_xattr
386 .It Ar "ACL inheritance flags"
387 Inheritance flags may be specified in either short or long form.
388 Short and long forms may not be mixed.
389 Access flags in long form are separated by the
391 character; in short form, they are concatenated together.
392 Valid inheritance flags are:
393 .Bl -tag -width ".Dv short"
408 Other than the "inherited" flag, inheritance flags may be only set on directories.
410 The ACL type field is either
416 ACL entries applied from a file using the
420 options shall be of the following form: one ACL entry per line, as
421 previously specified; whitespace is ignored; any text after a
423 is ignored (comments).
425 NFSv4 ACL entries are evaluated in their visible order.
427 Multiple ACL entries specified on the command line are
430 Note that the file owner is always granted the read_acl, write_acl,
431 read_attributes, and write_attributes permissions, even if the ACL
436 .Dl setfacl -d -m u::rwx,g::rx,o::rx,mask::rwx dir
437 .Dl setfacl -d -m g:admins:rwx dir
439 The first command sets the mandatory elements of the POSIX.1e default ACL.
440 The second command specifies that users in group admins can have read, write, and execute
441 permissions for directory named "dir".
442 It should be noted that any files or directories created underneath "dir" will
443 inherit these default ACLs upon creation.
445 .Dl setfacl -m u::rwx,g:mail:rw file
447 Sets read, write, and execute permissions for the
449 owner's POSIX.1e ACL entry and read and write permissions for group mail on
452 .Dl setfacl -m owner@:rwxp::allow,g:mail:rwp::allow file
454 Semantically equal to the example above, but for NFSv4 ACL.
456 .Dl setfacl -M file1 file2
458 Sets/updates the ACL entries contained in
463 .Dl setfacl -x g:mail:rw file
465 Remove the group mail POSIX.1e ACL entry containing read/write permissions
471 Remove the first entry from the NFSv4 ACL from
478 ACL entries except for the three required from
481 .Dl getfacl file1 | setfacl -b -n -M - file2
483 Copy ACL entries from
497 utility is expected to be
499 Std 1003.2c compliant.
501 Extended Attribute and Access Control List support was developed
504 Project and introduced in
506 NFSv4 ACL support was introduced in
512 utility was written by
513 .An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
514 NFSv4 ACL support was implemented by
515 .An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .