xref: /netbsd-src/bin/setfacl/setfacl.1 (revision f28f16fcc6285ae99726a72a73153ceb120ce14f)
1*f28f16fcSwiz.\" $NetBSD: setfacl.1,v 1.2 2020/06/18 19:43:53 wiz Exp $
29aa2a9c3Schristos.\"-
39aa2a9c3Schristos.\" Copyright (c) 2001 Chris D. Faulhaber
49aa2a9c3Schristos.\" Copyright (c) 2011 Edward Tomasz Napierała
59aa2a9c3Schristos.\" All rights reserved.
69aa2a9c3Schristos.\"
79aa2a9c3Schristos.\" Redistribution and use in source and binary forms, with or without
89aa2a9c3Schristos.\" modification, are permitted provided that the following conditions
99aa2a9c3Schristos.\" are met:
109aa2a9c3Schristos.\" 1. Redistributions of source code must retain the above copyright
119aa2a9c3Schristos.\"    notice, this list of conditions and the following disclaimer.
129aa2a9c3Schristos.\" 2. Redistributions in binary form must reproduce the above copyright
139aa2a9c3Schristos.\"    notice, this list of conditions and the following disclaimer in the
149aa2a9c3Schristos.\"    documentation and/or other materials provided with the distribution.
159aa2a9c3Schristos.\"
169aa2a9c3Schristos.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
179aa2a9c3Schristos.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
189aa2a9c3Schristos.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199aa2a9c3Schristos.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
209aa2a9c3Schristos.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
219aa2a9c3Schristos.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
229aa2a9c3Schristos.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
239aa2a9c3Schristos.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
249aa2a9c3Schristos.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
259aa2a9c3Schristos.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
269aa2a9c3Schristos.\" SUCH DAMAGE.
279aa2a9c3Schristos.\"
289aa2a9c3Schristos.\" $FreeBSD: head/bin/setfacl/setfacl.1 339793 2018-10-26 21:17:06Z markj $
299aa2a9c3Schristos.\"
309aa2a9c3Schristos.Dd October 26, 2018
319aa2a9c3Schristos.Dt SETFACL 1
329aa2a9c3Schristos.Os
339aa2a9c3Schristos.Sh NAME
349aa2a9c3Schristos.Nm setfacl
359aa2a9c3Schristos.Nd set ACL information
369aa2a9c3Schristos.Sh SYNOPSIS
379aa2a9c3Schristos.Nm
389aa2a9c3Schristos.Op Fl bdhkn
399aa2a9c3Schristos.Op Fl a Ar position entries
409aa2a9c3Schristos.Op Fl M Ar file
41*f28f16fcSwiz.Op Fl m Ar entries
42*f28f16fcSwiz.Op Fl R Op Fl H | L | P
439aa2a9c3Schristos.Op Fl X Ar file
44*f28f16fcSwiz.Op Fl x Ar entries | position
459aa2a9c3Schristos.Op Ar
469aa2a9c3Schristos.Sh DESCRIPTION
479aa2a9c3SchristosThe
489aa2a9c3Schristos.Nm
499aa2a9c3Schristosutility sets discretionary access control information on
509aa2a9c3Schristosthe specified file(s).
519aa2a9c3SchristosIf no files are specified, or the list consists of the only
529aa2a9c3Schristos.Sq Fl ,
539aa2a9c3Schristosthe file names are taken from the standard input.
549aa2a9c3Schristos.Pp
559aa2a9c3SchristosThe following options are available:
569aa2a9c3Schristos.Bl -tag -width indent
579aa2a9c3Schristos.It Fl a Ar position entries
589aa2a9c3SchristosModify the ACL on the specified files by inserting new
599aa2a9c3SchristosACL entries
609aa2a9c3Schristosspecified in
619aa2a9c3Schristos.Ar entries ,
629aa2a9c3Schristosstarting at position
639aa2a9c3Schristos.Ar position ,
649aa2a9c3Schristoscounting from zero.
659aa2a9c3SchristosThis option is only applicable to NFSv4 ACLs.
669aa2a9c3Schristos.It Fl b
679aa2a9c3SchristosRemove all ACL entries except for the ones synthesized
689aa2a9c3Schristosfrom the file mode - the three mandatory entries in case
699aa2a9c3Schristosof POSIX.1e ACL.
709aa2a9c3SchristosIf the POSIX.1e ACL contains a
719aa2a9c3Schristos.Dq Li mask
729aa2a9c3Schristosentry, the permissions of the
739aa2a9c3Schristos.Dq Li group
749aa2a9c3Schristosentry in the resulting ACL will be set to the permission
759aa2a9c3Schristosassociated with both the
769aa2a9c3Schristos.Dq Li group
779aa2a9c3Schristosand
789aa2a9c3Schristos.Dq Li mask
799aa2a9c3Schristosentries of the current ACL.
809aa2a9c3Schristos.It Fl d
819aa2a9c3SchristosThe operations apply to the default ACL entries instead of
829aa2a9c3Schristosaccess ACL entries.
839aa2a9c3SchristosCurrently only directories may have
849aa2a9c3Schristosdefault ACL's.
859aa2a9c3SchristosThis option is not applicable to NFSv4 ACLs.
869aa2a9c3Schristos.It Fl H
879aa2a9c3SchristosIf the
889aa2a9c3Schristos.Fl R
899aa2a9c3Schristosoption is specified, symbolic links on the command line are followed
909aa2a9c3Schristosand hence unaffected by the command.
919aa2a9c3Schristos(Symbolic links encountered during tree traversal are not followed.)
92*f28f16fcSwiz.It Fl h
93*f28f16fcSwizIf the target of the operation is a symbolic link, perform the operation
94*f28f16fcSwizon the symbolic link itself, rather than following the link.
959aa2a9c3Schristos.It Fl k
969aa2a9c3SchristosDelete any default ACL entries on the specified files.
97*f28f16fcSwizIt is not considered an error if the specified files do not have
989aa2a9c3Schristosany default ACL entries.
99*f28f16fcSwizAn error will be reported if any of the specified files cannot have
100*f28f16fcSwiza default entry (i.e., non-directories).
1019aa2a9c3SchristosThis option is not applicable to NFSv4 ACLs.
1029aa2a9c3Schristos.It Fl L
1039aa2a9c3SchristosIf the
1049aa2a9c3Schristos.Fl R
1059aa2a9c3Schristosoption is specified, all symbolic links are followed.
106*f28f16fcSwiz.It Fl M Ar file
107*f28f16fcSwizModify the ACL entries on the specified files by adding new
108*f28f16fcSwizACL entries and modifying existing ACL entries with the ACL
109*f28f16fcSwizentries specified in the file
110*f28f16fcSwiz.Ar file .
111*f28f16fcSwizIf
112*f28f16fcSwiz.Ar file
113*f28f16fcSwizis
114*f28f16fcSwiz.Fl ,
115*f28f16fcSwizthe input is taken from stdin.
1169aa2a9c3Schristos.It Fl m Ar entries
1179aa2a9c3SchristosModify the ACL on the specified file.
1189aa2a9c3SchristosNew entries will be added, and existing entries will be modified
1199aa2a9c3Schristosaccording to the
1209aa2a9c3Schristos.Ar entries
1219aa2a9c3Schristosargument.
1229aa2a9c3SchristosFor NFSv4 ACLs, it is recommended to use the
1239aa2a9c3Schristos.Fl a
1249aa2a9c3Schristosand
1259aa2a9c3Schristos.Fl x
1269aa2a9c3Schristosoptions instead.
1279aa2a9c3Schristos.It Fl n
128*f28f16fcSwizDo not recalculate the permissions associated with the ACL mask entry.
1299aa2a9c3SchristosThis option is not applicable to NFSv4 ACLs.
1309aa2a9c3Schristos.It Fl P
1319aa2a9c3SchristosIf the
1329aa2a9c3Schristos.Fl R
1339aa2a9c3Schristosoption is specified, no symbolic links are followed.
1349aa2a9c3SchristosThis is the default.
1359aa2a9c3Schristos.It Fl R
1369aa2a9c3SchristosPerform the action recursively on any specified directories.
1379aa2a9c3SchristosWhen modifying or adding NFSv4 ACL entries, inheritance flags
1389aa2a9c3Schristosare applied only to directories.
139*f28f16fcSwiz.It Fl X Ar file
140*f28f16fcSwizRemove the ACL entries specified in the file
141*f28f16fcSwiz.Ar file
142*f28f16fcSwizfrom the access or default ACL of the specified files.
1439aa2a9c3Schristos.It Fl x Ar entries | position
1449aa2a9c3SchristosIf
1459aa2a9c3Schristos.Ar entries
1469aa2a9c3Schristosis specified, remove the ACL entries specified there
1479aa2a9c3Schristosfrom the access or default ACL of the specified files.
1489aa2a9c3SchristosOtherwise, remove entry at index
1499aa2a9c3Schristos.Ar position ,
1509aa2a9c3Schristoscounting from zero.
1519aa2a9c3Schristos.El
1529aa2a9c3Schristos.Pp
1539aa2a9c3SchristosThe above options are evaluated in the order specified
1549aa2a9c3Schristoson the command-line.
1559aa2a9c3Schristos.Sh POSIX.1e ACL ENTRIES
1569aa2a9c3SchristosA POSIX.1E ACL entry contains three colon-separated fields:
1579aa2a9c3Schristosan ACL tag, an ACL qualifier, and discretionary access
1589aa2a9c3Schristospermissions:
1599aa2a9c3Schristos.Bl -tag -width indent
1609aa2a9c3Schristos.It Ar "ACL tag"
1619aa2a9c3SchristosThe ACL tag specifies the ACL entry type and consists of
1629aa2a9c3Schristosone of the following:
1639aa2a9c3Schristos.Dq Li user
1649aa2a9c3Schristosor
1659aa2a9c3Schristos.Ql u
1669aa2a9c3Schristosspecifying the access
1679aa2a9c3Schristosgranted to the owner of the file or a specified user;
1689aa2a9c3Schristos.Dq Li group
1699aa2a9c3Schristosor
1709aa2a9c3Schristos.Ql g
1719aa2a9c3Schristosspecifying the access granted to the file owning group
1729aa2a9c3Schristosor a specified group;
1739aa2a9c3Schristos.Dq Li other
1749aa2a9c3Schristosor
1759aa2a9c3Schristos.Ql o
1769aa2a9c3Schristosspecifying the access
1779aa2a9c3Schristosgranted to any process that does not match any user or group
1789aa2a9c3SchristosACL entry;
1799aa2a9c3Schristos.Dq Li mask
1809aa2a9c3Schristosor
1819aa2a9c3Schristos.Ql m
1829aa2a9c3Schristosspecifying the maximum access
1839aa2a9c3Schristosgranted to any ACL entry except the
1849aa2a9c3Schristos.Dq Li user
1859aa2a9c3SchristosACL entry for the file owner and the
1869aa2a9c3Schristos.Dq Li other
1879aa2a9c3SchristosACL entry.
1889aa2a9c3Schristos.It Ar "ACL qualifier"
1899aa2a9c3SchristosThe ACL qualifier field describes the user or group associated with
1909aa2a9c3Schristosthe ACL entry.
191*f28f16fcSwizIt may consist of one of the following: UID or
192*f28f16fcSwizuser name, GID or group name, or empty.
1939aa2a9c3SchristosFor
1949aa2a9c3Schristos.Dq Li user
1959aa2a9c3SchristosACL entries, an empty field specifies access granted to the
1969aa2a9c3Schristosfile owner.
1979aa2a9c3SchristosFor
1989aa2a9c3Schristos.Dq Li group
1999aa2a9c3SchristosACL entries, an empty field specifies access granted to the
2009aa2a9c3Schristosfile owning group.
2019aa2a9c3Schristos.Dq Li mask
2029aa2a9c3Schristosand
2039aa2a9c3Schristos.Dq Li other
2049aa2a9c3SchristosACL entries do not use this field.
2059aa2a9c3Schristos.It Ar "access permissions"
2069aa2a9c3SchristosThe access permissions field contains up to one of each of
2079aa2a9c3Schristosthe following:
2089aa2a9c3Schristos.Ql r ,
2099aa2a9c3Schristos.Ql w ,
2109aa2a9c3Schristosand
2119aa2a9c3Schristos.Ql x
2129aa2a9c3Schristosto set read, write, and
2139aa2a9c3Schristosexecute permissions, respectively.
2149aa2a9c3SchristosEach of these may be excluded
2159aa2a9c3Schristosor replaced with a
2169aa2a9c3Schristos.Ql -
2179aa2a9c3Schristoscharacter to indicate no access.
2189aa2a9c3Schristos.El
2199aa2a9c3Schristos.Pp
2209aa2a9c3SchristosA
2219aa2a9c3Schristos.Dq Li mask
2229aa2a9c3SchristosACL entry is required on a file with any ACL entries other than
2239aa2a9c3Schristosthe default
2249aa2a9c3Schristos.Dq Li user ,
2259aa2a9c3Schristos.Dq Li group ,
2269aa2a9c3Schristosand
2279aa2a9c3Schristos.Dq Li other
2289aa2a9c3SchristosACL entries.
2299aa2a9c3SchristosIf the
2309aa2a9c3Schristos.Fl n
2319aa2a9c3Schristosoption is not specified and no
2329aa2a9c3Schristos.Dq Li mask
2339aa2a9c3SchristosACL entry was specified, the
2349aa2a9c3Schristos.Nm
2359aa2a9c3Schristosutility
2369aa2a9c3Schristoswill apply a
2379aa2a9c3Schristos.Dq Li mask
2389aa2a9c3SchristosACL entry consisting of the union of the permissions associated
2399aa2a9c3Schristoswith all
2409aa2a9c3Schristos.Dq Li group
2419aa2a9c3SchristosACL entries in the resulting ACL.
2429aa2a9c3Schristos.Pp
2439aa2a9c3SchristosTraditional POSIX interfaces acting on file system object modes have
2449aa2a9c3Schristosmodified semantics in the presence of POSIX.1e extended ACLs.
2459aa2a9c3SchristosWhen a mask entry is present on the access ACL of an object, the mask
2469aa2a9c3Schristosentry is substituted for the group bits; this occurs in programs such
2479aa2a9c3Schristosas
2489aa2a9c3Schristos.Xr stat 1
2499aa2a9c3Schristosor
2509aa2a9c3Schristos.Xr ls 1 .
2519aa2a9c3SchristosWhen the mode is modified on an object that has a mask entry, the
2529aa2a9c3Schristoschanges applied to the group bits will actually be applied to the
2539aa2a9c3Schristosmask entry.
2549aa2a9c3SchristosThese semantics provide for greater application compatibility:
2559aa2a9c3Schristosapplications modifying the mode instead of the ACL will see
2569aa2a9c3Schristosconservative behavior, limiting the effective rights granted by all
2579aa2a9c3Schristosof the additional user and group entries; this occurs in programs
2589aa2a9c3Schristossuch as
2599aa2a9c3Schristos.Xr chmod 1 .
2609aa2a9c3Schristos.Pp
2619aa2a9c3SchristosACL entries applied from a file using the
2629aa2a9c3Schristos.Fl M
2639aa2a9c3Schristosor
2649aa2a9c3Schristos.Fl X
2659aa2a9c3Schristosoptions shall be of the following form: one ACL entry per line, as
2669aa2a9c3Schristospreviously specified; whitespace is ignored; any text after a
2679aa2a9c3Schristos.Ql #
2689aa2a9c3Schristosis ignored (comments).
2699aa2a9c3Schristos.Pp
2709aa2a9c3SchristosWhen POSIX.1e ACL entries are evaluated, the access check algorithm checks
2719aa2a9c3Schristosthe ACL entries in the following order: file owner,
2729aa2a9c3Schristos.Dq Li user
2739aa2a9c3SchristosACL entries, file owning group,
2749aa2a9c3Schristos.Dq Li group
2759aa2a9c3SchristosACL entries, and
2769aa2a9c3Schristos.Dq Li other
2779aa2a9c3SchristosACL entry.
2789aa2a9c3Schristos.Pp
2799aa2a9c3SchristosMultiple ACL entries specified on the command line are
2809aa2a9c3Schristosseparated by commas.
2819aa2a9c3Schristos.Pp
2829aa2a9c3SchristosIt is possible for files and directories to inherit ACL entries from their
2839aa2a9c3Schristosparent directory.
2849aa2a9c3SchristosThis is accomplished through the use of the default ACL.
2859aa2a9c3SchristosIt should be noted that before you can specify a default ACL, the mandatory
2869aa2a9c3SchristosACL entries for user, group, other and mask must be set.
2879aa2a9c3SchristosFor more details see the examples below.
2889aa2a9c3SchristosDefault ACLs can be created by using
2899aa2a9c3Schristos.Fl d .
2909aa2a9c3Schristos.Sh NFSv4 ACL ENTRIES
2919aa2a9c3SchristosAn NFSv4 ACL entry contains four or five colon-separated fields: an ACL tag,
2929aa2a9c3Schristosan ACL qualifier (only for
2939aa2a9c3Schristos.Dq Li user
2949aa2a9c3Schristosand
2959aa2a9c3Schristos.Dq Li group
2969aa2a9c3Schristostags), discretionary access permissions, ACL inheritance flags, and ACL type:
2979aa2a9c3Schristos.Bl -tag -width indent
2989aa2a9c3Schristos.It Ar "ACL tag"
2999aa2a9c3SchristosThe ACL tag specifies the ACL entry type and consists of
3009aa2a9c3Schristosone of the following:
3019aa2a9c3Schristos.Dq Li user
3029aa2a9c3Schristosor
3039aa2a9c3Schristos.Ql u
3049aa2a9c3Schristosspecifying the access
3059aa2a9c3Schristosgranted to the specified user;
3069aa2a9c3Schristos.Dq Li group
3079aa2a9c3Schristosor
3089aa2a9c3Schristos.Ql g
3099aa2a9c3Schristosspecifying the access granted to the specified group;
3109aa2a9c3Schristos.Dq Li owner@
3119aa2a9c3Schristosspecifying the access granted to the owner of the file;
3129aa2a9c3Schristos.Dq Li group@
3139aa2a9c3Schristosspecifying the access granted to the file owning group;
3149aa2a9c3Schristos.Dq Li everyone@
3159aa2a9c3Schristosspecifying everyone.
3169aa2a9c3SchristosNote that
3179aa2a9c3Schristos.Dq Li everyone@
3189aa2a9c3Schristosis not the same as traditional Unix
3199aa2a9c3Schristos.Dq Li other
3209aa2a9c3Schristos- it means,
3219aa2a9c3Schristosliterally, everyone, including file owner and owning group.
3229aa2a9c3Schristos.It Ar "ACL qualifier"
3239aa2a9c3SchristosThe ACL qualifier field describes the user or group associated with
3249aa2a9c3Schristosthe ACL entry.
325*f28f16fcSwizIt may consist of one of the following: UID or
326*f28f16fcSwizuser name, or GID or group name.
3279aa2a9c3SchristosIn entries whose tag type is one of
3289aa2a9c3Schristos.Dq Li owner@ ,
3299aa2a9c3Schristos.Dq Li group@ ,
3309aa2a9c3Schristosor
3319aa2a9c3Schristos.Dq Li everyone@ ,
3329aa2a9c3Schristosthis field is omitted altogether, including the trailing comma.
3339aa2a9c3Schristos.It Ar "access permissions"
3349aa2a9c3SchristosAccess permissions may be specified in either short or long form.
3359aa2a9c3SchristosShort and long forms may not be mixed.
3369aa2a9c3SchristosPermissions in long form are separated by the
3379aa2a9c3Schristos.Ql /
3389aa2a9c3Schristoscharacter; in short form, they are concatenated together.
3399aa2a9c3SchristosValid permissions are:
3409aa2a9c3Schristos.Bl -tag -width ".Dv modify_set"
3419aa2a9c3Schristos.It Short
3429aa2a9c3SchristosLong
3439aa2a9c3Schristos.It r
3449aa2a9c3Schristosread_data
3459aa2a9c3Schristos.It w
3469aa2a9c3Schristoswrite_data
3479aa2a9c3Schristos.It x
3489aa2a9c3Schristosexecute
3499aa2a9c3Schristos.It p
3509aa2a9c3Schristosappend_data
3519aa2a9c3Schristos.It D
3529aa2a9c3Schristosdelete_child
3539aa2a9c3Schristos.It d
3549aa2a9c3Schristosdelete
3559aa2a9c3Schristos.It a
3569aa2a9c3Schristosread_attributes
3579aa2a9c3Schristos.It A
3589aa2a9c3Schristoswrite_attributes
3599aa2a9c3Schristos.It R
3609aa2a9c3Schristosread_xattr
3619aa2a9c3Schristos.It W
3629aa2a9c3Schristoswrite_xattr
3639aa2a9c3Schristos.It c
3649aa2a9c3Schristosread_acl
3659aa2a9c3Schristos.It C
3669aa2a9c3Schristoswrite_acl
3679aa2a9c3Schristos.It o
3689aa2a9c3Schristoswrite_owner
3699aa2a9c3Schristos.It s
3709aa2a9c3Schristossynchronize
3719aa2a9c3Schristos.El
3729aa2a9c3Schristos.Pp
3739aa2a9c3SchristosIn addition, the following permission sets may be used:
3749aa2a9c3Schristos.Bl -tag -width ".Dv modify_set"
3759aa2a9c3Schristos.It Set
3769aa2a9c3SchristosPermissions
3779aa2a9c3Schristos.It full_set
3789aa2a9c3Schristosall permissions, as shown above
3799aa2a9c3Schristos.It modify_set
3809aa2a9c3Schristosall permissions except write_acl and write_owner
3819aa2a9c3Schristos.It read_set
3829aa2a9c3Schristosread_data, read_attributes, read_xattr and read_acl
3839aa2a9c3Schristos.It write_set
3849aa2a9c3Schristoswrite_data, append_data, write_attributes and write_xattr
3859aa2a9c3Schristos.El
3869aa2a9c3Schristos.It Ar "ACL inheritance flags"
3879aa2a9c3SchristosInheritance flags may be specified in either short or long form.
3889aa2a9c3SchristosShort and long forms may not be mixed.
3899aa2a9c3SchristosAccess flags in long form are separated by the
3909aa2a9c3Schristos.Ql /
3919aa2a9c3Schristoscharacter; in short form, they are concatenated together.
3929aa2a9c3SchristosValid inheritance flags are:
3939aa2a9c3Schristos.Bl -tag -width ".Dv short"
3949aa2a9c3Schristos.It Short
3959aa2a9c3SchristosLong
3969aa2a9c3Schristos.It f
3979aa2a9c3Schristosfile_inherit
3989aa2a9c3Schristos.It d
3999aa2a9c3Schristosdir_inherit
4009aa2a9c3Schristos.It i
4019aa2a9c3Schristosinherit_only
4029aa2a9c3Schristos.It n
4039aa2a9c3Schristosno_propagate
4049aa2a9c3Schristos.It I
4059aa2a9c3Schristosinherited
4069aa2a9c3Schristos.El
4079aa2a9c3Schristos.Pp
4089aa2a9c3SchristosOther than the "inherited" flag, inheritance flags may be only set on directories.
4099aa2a9c3Schristos.It Ar "ACL type"
4109aa2a9c3SchristosThe ACL type field is either
4119aa2a9c3Schristos.Dq Li allow
4129aa2a9c3Schristosor
4139aa2a9c3Schristos.Dq Li deny .
4149aa2a9c3Schristos.El
4159aa2a9c3Schristos.Pp
4169aa2a9c3SchristosACL entries applied from a file using the
4179aa2a9c3Schristos.Fl M
4189aa2a9c3Schristosor
4199aa2a9c3Schristos.Fl X
4209aa2a9c3Schristosoptions shall be of the following form: one ACL entry per line, as
4219aa2a9c3Schristospreviously specified; whitespace is ignored; any text after a
4229aa2a9c3Schristos.Ql #
4239aa2a9c3Schristosis ignored (comments).
4249aa2a9c3Schristos.Pp
4259aa2a9c3SchristosNFSv4 ACL entries are evaluated in their visible order.
4269aa2a9c3Schristos.Pp
4279aa2a9c3SchristosMultiple ACL entries specified on the command line are
4289aa2a9c3Schristosseparated by commas.
4299aa2a9c3Schristos.Pp
4309aa2a9c3SchristosNote that the file owner is always granted the read_acl, write_acl,
4319aa2a9c3Schristosread_attributes, and write_attributes permissions, even if the ACL
4329aa2a9c3Schristoswould deny it.
4339aa2a9c3Schristos.Sh EXIT STATUS
4349aa2a9c3Schristos.Ex -std
4359aa2a9c3Schristos.Sh EXAMPLES
4369aa2a9c3Schristos.Dl setfacl -d -m u::rwx,g::rx,o::rx,mask::rwx dir
4379aa2a9c3Schristos.Dl setfacl -d -m g:admins:rwx dir
4389aa2a9c3Schristos.Pp
4399aa2a9c3SchristosThe first command sets the mandatory elements of the POSIX.1e default ACL.
4409aa2a9c3SchristosThe second command specifies that users in group admins can have read, write, and execute
4419aa2a9c3Schristospermissions for directory named "dir".
4429aa2a9c3SchristosIt should be noted that any files or directories created underneath "dir" will
4439aa2a9c3Schristosinherit these default ACLs upon creation.
4449aa2a9c3Schristos.Pp
4459aa2a9c3Schristos.Dl setfacl -m u::rwx,g:mail:rw file
4469aa2a9c3Schristos.Pp
4479aa2a9c3SchristosSets read, write, and execute permissions for the
4489aa2a9c3Schristos.Pa file
4499aa2a9c3Schristosowner's POSIX.1e ACL entry and read and write permissions for group mail on
4509aa2a9c3Schristos.Pa file .
4519aa2a9c3Schristos.Pp
4529aa2a9c3Schristos.Dl setfacl -m owner@:rwxp::allow,g:mail:rwp::allow file
4539aa2a9c3Schristos.Pp
4549aa2a9c3SchristosSemantically equal to the example above, but for NFSv4 ACL.
4559aa2a9c3Schristos.Pp
4569aa2a9c3Schristos.Dl setfacl -M file1 file2
4579aa2a9c3Schristos.Pp
4589aa2a9c3SchristosSets/updates the ACL entries contained in
4599aa2a9c3Schristos.Pa file1
4609aa2a9c3Schristoson
4619aa2a9c3Schristos.Pa file2 .
4629aa2a9c3Schristos.Pp
4639aa2a9c3Schristos.Dl setfacl -x g:mail:rw file
4649aa2a9c3Schristos.Pp
4659aa2a9c3SchristosRemove the group mail POSIX.1e ACL entry containing read/write permissions
4669aa2a9c3Schristosfrom
4679aa2a9c3Schristos.Pa file .
4689aa2a9c3Schristos.Pp
4699aa2a9c3Schristos.Dl setfacl -x0 file
4709aa2a9c3Schristos.Pp
4719aa2a9c3SchristosRemove the first entry from the NFSv4 ACL from
4729aa2a9c3Schristos.Pa file .
4739aa2a9c3Schristos.Pp
4749aa2a9c3Schristos.Dl setfacl -bn file
4759aa2a9c3Schristos.Pp
4769aa2a9c3SchristosRemove all
4779aa2a9c3Schristos.Dq Li access
4789aa2a9c3SchristosACL entries except for the three required from
4799aa2a9c3Schristos.Pa file .
4809aa2a9c3Schristos.Pp
4819aa2a9c3Schristos.Dl getfacl file1 | setfacl -b -n -M - file2
4829aa2a9c3Schristos.Pp
4839aa2a9c3SchristosCopy ACL entries from
4849aa2a9c3Schristos.Pa file1
4859aa2a9c3Schristosto
4869aa2a9c3Schristos.Pa file2 .
4879aa2a9c3Schristos.Sh SEE ALSO
488*f28f16fcSwiz.Xr getextattr 1 ,
4899aa2a9c3Schristos.Xr getfacl 1 ,
490*f28f16fcSwiz.Xr setextattr 1 ,
4919aa2a9c3Schristos.Xr acl 3 ,
492*f28f16fcSwiz.\".Xr acl 9 ,
4939aa2a9c3Schristos.Xr extattr 9
4949aa2a9c3Schristos.Sh STANDARDS
4959aa2a9c3SchristosThe
4969aa2a9c3Schristos.Nm
4979aa2a9c3Schristosutility is expected to be
4989aa2a9c3Schristos.Tn IEEE
4999aa2a9c3SchristosStd 1003.2c compliant.
5009aa2a9c3Schristos.Sh HISTORY
5019aa2a9c3SchristosExtended Attribute and Access Control List support was developed
5029aa2a9c3Schristosas part of the
5039aa2a9c3Schristos.Tn TrustedBSD
5049aa2a9c3SchristosProject and introduced in
5059aa2a9c3Schristos.Fx 5.0 .
5069aa2a9c3SchristosNFSv4 ACL support was introduced in
5079aa2a9c3Schristos.Fx 8.1 .
5089aa2a9c3Schristos.Sh AUTHORS
5099aa2a9c3Schristos.An -nosplit
5109aa2a9c3SchristosThe
5119aa2a9c3Schristos.Nm
5129aa2a9c3Schristosutility was written by
5139aa2a9c3Schristos.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
5149aa2a9c3SchristosNFSv4 ACL support was implemented by
5159aa2a9c3Schristos.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .
516