xref: /freebsd/bin/setfacl/setfacl.1 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
19ddb49cbSWarner Losh.\"-
243960f15SRobert Watson.\" Copyright (c) 2001 Chris D. Faulhaber
3181b4eebSEdward Tomasz Napierala.\" Copyright (c) 2011 Edward Tomasz Napierała
443960f15SRobert Watson.\" All rights reserved.
543960f15SRobert Watson.\"
643960f15SRobert Watson.\" Redistribution and use in source and binary forms, with or without
743960f15SRobert Watson.\" modification, are permitted provided that the following conditions
843960f15SRobert Watson.\" are met:
943960f15SRobert Watson.\" 1. Redistributions of source code must retain the above copyright
1043960f15SRobert Watson.\"    notice, this list of conditions and the following disclaimer.
1143960f15SRobert Watson.\" 2. Redistributions in binary form must reproduce the above copyright
1243960f15SRobert Watson.\"    notice, this list of conditions and the following disclaimer in the
1343960f15SRobert Watson.\"    documentation and/or other materials provided with the distribution.
1443960f15SRobert Watson.\"
1543960f15SRobert Watson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1643960f15SRobert Watson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1743960f15SRobert Watson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18a303eae7SJoel Dahl.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19a303eae7SJoel Dahl.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20a303eae7SJoel Dahl.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21a303eae7SJoel Dahl.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22a303eae7SJoel Dahl.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23a303eae7SJoel Dahl.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24a303eae7SJoel Dahl.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25a303eae7SJoel Dahl.\" SUCH DAMAGE.
2643960f15SRobert Watson.\"
27*fef74e99SCeri Davies.Dd April 29, 2023
2843960f15SRobert Watson.Dt SETFACL 1
2943960f15SRobert Watson.Os
3043960f15SRobert Watson.Sh NAME
3143960f15SRobert Watson.Nm setfacl
32eb083802SRuslan Ermilov.Nd set ACL information
3343960f15SRobert Watson.Sh SYNOPSIS
3403035079SRuslan Ermilov.Nm
350629b152SEd Maste.Op Fl R Op Fl H | L | P
368051fddeSRobert Watson.Op Fl bdhkn
373f221878SEdward Tomasz Napierala.Op Fl a Ar position entries
3843960f15SRobert Watson.Op Fl m Ar entries
39a89237aeSRuslan Ermilov.Op Fl M Ar file
403f221878SEdward Tomasz Napierala.Op Fl x Ar entries | position
41a89237aeSRuslan Ermilov.Op Fl X Ar file
4203035079SRuslan Ermilov.Op Ar
4343960f15SRobert Watson.Sh DESCRIPTION
4443960f15SRobert WatsonThe
4543960f15SRobert Watson.Nm
4643960f15SRobert Watsonutility sets discretionary access control information on
4716276328SMaxim Konovalovthe specified file(s).
489badf57fSRuslan ErmilovIf no files are specified, or the list consists of the only
499badf57fSRuslan Ermilov.Sq Fl ,
509badf57fSRuslan Ermilovthe file names are taken from the standard input.
5143960f15SRobert Watson.Pp
5243960f15SRobert WatsonThe following options are available:
5343960f15SRobert Watson.Bl -tag -width indent
543f221878SEdward Tomasz Napierala.It Fl a Ar position entries
553f221878SEdward Tomasz NapieralaModify the ACL on the specified files by inserting new
563f221878SEdward Tomasz NapieralaACL entries
573f221878SEdward Tomasz Napieralaspecified in
583f221878SEdward Tomasz Napierala.Ar entries ,
593f221878SEdward Tomasz Napieralastarting at position
603f221878SEdward Tomasz Napierala.Ar position ,
613f221878SEdward Tomasz Napieralacounting from zero.
623f221878SEdward Tomasz NapieralaThis option is only applicable to NFSv4 ACLs.
6343960f15SRobert Watson.It Fl b
64fe819cedSEdward Tomasz NapieralaRemove all ACL entries except for the ones synthesized
65fe819cedSEdward Tomasz Napieralafrom the file mode - the three mandatory entries in case
66fe819cedSEdward Tomasz Napieralaof POSIX.1e ACL.
673f221878SEdward Tomasz NapieralaIf the POSIX.1e ACL contains a
68458ad6cbSChris D. Faulhaber.Dq Li mask
69458ad6cbSChris D. Faulhaberentry, the permissions of the
70458ad6cbSChris D. Faulhaber.Dq Li group
71458ad6cbSChris D. Faulhaberentry in the resulting ACL will be set to the permission
72a93dfd0fSRuslan Ermilovassociated with both the
73458ad6cbSChris D. Faulhaber.Dq Li group
74458ad6cbSChris D. Faulhaberand
75458ad6cbSChris D. Faulhaber.Dq Li mask
76458ad6cbSChris D. Faulhaberentries of the current ACL.
7743960f15SRobert Watson.It Fl d
7843960f15SRobert WatsonThe operations apply to the default ACL entries instead of
79eccea571SRuslan Ermilovaccess ACL entries.
80eccea571SRuslan ErmilovCurrently only directories may have
8121c5f7deSEd Mastedefault ACL's.
8221c5f7deSEd MasteThis option is not applicable to NFSv4 ACLs.
838051fddeSRobert Watson.It Fl h
848051fddeSRobert WatsonIf the target of the operation is a symbolic link, perform the operation
858051fddeSRobert Watsonon the symbolic link itself, rather than following the link.
860629b152SEd Maste.It Fl H
870629b152SEd MasteIf the
880629b152SEd Maste.Fl R
890629b152SEd Masteoption is specified, symbolic links on the command line are followed
900629b152SEd Masteand hence unaffected by the command.
910629b152SEd Maste(Symbolic links encountered during tree traversal are not followed.)
9243960f15SRobert Watson.It Fl k
93eccea571SRuslan ErmilovDelete any default ACL entries on the specified files.
94eccea571SRuslan ErmilovIt
9543960f15SRobert Watsonis not considered an error if the specified files do not have
96eccea571SRuslan Ermilovany default ACL entries.
97eccea571SRuslan ErmilovAn error will be reported if any of
9821c5f7deSEd Mastethe specified files cannot have a default entry (i.e.,
9921c5f7deSEd Mastenon-directories).
10021c5f7deSEd MasteThis option is not applicable to NFSv4 ACLs.
1010629b152SEd Maste.It Fl L
1020629b152SEd MasteIf the
1030629b152SEd Maste.Fl R
1040629b152SEd Masteoption is specified, all symbolic links are followed.
10543960f15SRobert Watson.It Fl m Ar entries
106bac44ad2SEdward Tomasz NapieralaModify the ACL on the specified file.
107bac44ad2SEdward Tomasz NapieralaNew entries will be added, and existing entries will be modified
108bac44ad2SEdward Tomasz Napieralaaccording to the
109bac44ad2SEdward Tomasz Napierala.Ar entries
110bac44ad2SEdward Tomasz Napieralaargument.
1115293f9beSEdward Tomasz NapieralaFor NFSv4 ACLs, it is recommended to use the
1125293f9beSEdward Tomasz Napierala.Fl a
1135293f9beSEdward Tomasz Napieralaand
1145293f9beSEdward Tomasz Napierala.Fl x
115bac44ad2SEdward Tomasz Napieralaoptions instead.
11643960f15SRobert Watson.It Fl M Ar file
11743960f15SRobert WatsonModify the ACL entries on the specified files by adding new
11843960f15SRobert WatsonACL entries and modifying existing ACL entries with the ACL
11943960f15SRobert Watsonentries specified in the file
12043960f15SRobert Watson.Ar file .
12143960f15SRobert WatsonIf
12243960f15SRobert Watson.Ar file
12303035079SRuslan Ermilovis
12403035079SRuslan Ermilov.Fl ,
12503035079SRuslan Ermilovthe input is taken from stdin.
12643960f15SRobert Watson.It Fl n
12743960f15SRobert WatsonDo not recalculate the permissions associated with the ACL
128f3aff7c9SBenjamin Kadukmask entry.
129f3aff7c9SBenjamin KadukThis option is not applicable to NFSv4 ACLs.
1300629b152SEd Maste.It Fl P
1310629b152SEd MasteIf the
1320629b152SEd Maste.Fl R
1330629b152SEd Masteoption is specified, no symbolic links are followed.
1340629b152SEd MasteThis is the default.
1350629b152SEd Maste.It Fl R
1360629b152SEd MastePerform the action recursively on any specified directories.
13715e59435SMark JohnstonWhen modifying or adding NFSv4 ACL entries, inheritance flags
13815e59435SMark Johnstonare applied only to directories.
1393f221878SEdward Tomasz Napierala.It Fl x Ar entries | position
1403f221878SEdward Tomasz NapieralaIf
14143960f15SRobert Watson.Ar entries
1423f221878SEdward Tomasz Napieralais specified, remove the ACL entries specified there
14343960f15SRobert Watsonfrom the access or default ACL of the specified files.
1443f221878SEdward Tomasz NapieralaOtherwise, remove entry at index
1453f221878SEdward Tomasz Napierala.Ar position ,
1463f221878SEdward Tomasz Napieralacounting from zero.
14743960f15SRobert Watson.It Fl X Ar file
14843960f15SRobert WatsonRemove the ACL entries specified in the file
14943960f15SRobert Watson.Ar file
15043960f15SRobert Watsonfrom the access or default ACL of the specified files.
15143960f15SRobert Watson.El
15243960f15SRobert Watson.Pp
15343960f15SRobert WatsonThe above options are evaluated in the order specified
15443960f15SRobert Watsonon the command-line.
1553f221878SEdward Tomasz Napierala.Sh POSIX.1e ACL ENTRIES
1563f221878SEdward Tomasz NapieralaA POSIX.1E ACL entry contains three colon-separated fields:
15743960f15SRobert Watsonan ACL tag, an ACL qualifier, and discretionary access
15843960f15SRobert Watsonpermissions:
15943960f15SRobert Watson.Bl -tag -width indent
16003035079SRuslan Ermilov.It Ar "ACL tag"
16103035079SRuslan ErmilovThe ACL tag specifies the ACL entry type and consists of
16203035079SRuslan Ermilovone of the following:
16303035079SRuslan Ermilov.Dq Li user
16403035079SRuslan Ermilovor
16503035079SRuslan Ermilov.Ql u
16603035079SRuslan Ermilovspecifying the access
16703035079SRuslan Ermilovgranted to the owner of the file or a specified user;
16803035079SRuslan Ermilov.Dq Li group
16903035079SRuslan Ermilovor
17003035079SRuslan Ermilov.Ql g
17103035079SRuslan Ermilovspecifying the access granted to the file owning group
17203035079SRuslan Ermilovor a specified group;
17303035079SRuslan Ermilov.Dq Li other
17403035079SRuslan Ermilovor
17503035079SRuslan Ermilov.Ql o
17603035079SRuslan Ermilovspecifying the access
17743960f15SRobert Watsongranted to any process that does not match any user or group
17803035079SRuslan ErmilovACL entry;
17903035079SRuslan Ermilov.Dq Li mask
18003035079SRuslan Ermilovor
18103035079SRuslan Ermilov.Ql m
18203035079SRuslan Ermilovspecifying the maximum access
18343960f15SRobert Watsongranted to any ACL entry except the
18403035079SRuslan Ermilov.Dq Li user
18543960f15SRobert WatsonACL entry for the file owner and the
18603035079SRuslan Ermilov.Dq Li other
18743960f15SRobert WatsonACL entry.
18803035079SRuslan Ermilov.It Ar "ACL qualifier"
18943960f15SRobert WatsonThe ACL qualifier field describes the user or group associated with
190eccea571SRuslan Ermilovthe ACL entry.
191eccea571SRuslan ErmilovIt may consist of one of the following: uid or
192eccea571SRuslan Ermilovuser name, gid or group name, or empty.
193eccea571SRuslan ErmilovFor
19403035079SRuslan Ermilov.Dq Li user
19503035079SRuslan ErmilovACL entries, an empty field specifies access granted to the
196eccea571SRuslan Ermilovfile owner.
197eccea571SRuslan ErmilovFor
19803035079SRuslan Ermilov.Dq Li group
19903035079SRuslan ErmilovACL entries, an empty field specifies access granted to the
20043960f15SRobert Watsonfile owning group.
20103035079SRuslan Ermilov.Dq Li mask
20243960f15SRobert Watsonand
20303035079SRuslan Ermilov.Dq Li other
20443960f15SRobert WatsonACL entries do not use this field.
20503035079SRuslan Ermilov.It Ar "access permissions"
20603035079SRuslan ErmilovThe access permissions field contains up to one of each of
20703035079SRuslan Ermilovthe following:
20803035079SRuslan Ermilov.Ql r ,
20903035079SRuslan Ermilov.Ql w ,
21003035079SRuslan Ermilovand
21103035079SRuslan Ermilov.Ql x
21203035079SRuslan Ermilovto set read, write, and
213eccea571SRuslan Ermilovexecute permissions, respectively.
214eccea571SRuslan ErmilovEach of these may be excluded
21503035079SRuslan Ermilovor replaced with a
21603035079SRuslan Ermilov.Ql -
21703035079SRuslan Ermilovcharacter to indicate no access.
21843960f15SRobert Watson.El
21943960f15SRobert Watson.Pp
22043960f15SRobert WatsonA
22103035079SRuslan Ermilov.Dq Li mask
22243960f15SRobert WatsonACL entry is required on a file with any ACL entries other than
22343960f15SRobert Watsonthe default
22403035079SRuslan Ermilov.Dq Li user ,
22503035079SRuslan Ermilov.Dq Li group ,
22643960f15SRobert Watsonand
22703035079SRuslan Ermilov.Dq Li other
228eccea571SRuslan ErmilovACL entries.
229eccea571SRuslan ErmilovIf the
23043960f15SRobert Watson.Fl n
23143960f15SRobert Watsonoption is not specified and no
23203035079SRuslan Ermilov.Dq Li mask
23343960f15SRobert WatsonACL entry was specified, the
23443960f15SRobert Watson.Nm
23543960f15SRobert Watsonutility
23643960f15SRobert Watsonwill apply a
23703035079SRuslan Ermilov.Dq Li mask
23843960f15SRobert WatsonACL entry consisting of the union of the permissions associated
23943960f15SRobert Watsonwith all
24003035079SRuslan Ermilov.Dq Li group
24143960f15SRobert WatsonACL entries in the resulting ACL.
24243960f15SRobert Watson.Pp
243ea039906SRobert WatsonTraditional POSIX interfaces acting on file system object modes have
244ea039906SRobert Watsonmodified semantics in the presence of POSIX.1e extended ACLs.
245ea039906SRobert WatsonWhen a mask entry is present on the access ACL of an object, the mask
246ea039906SRobert Watsonentry is substituted for the group bits; this occurs in programs such
247ea039906SRobert Watsonas
248ea039906SRobert Watson.Xr stat 1
249ea039906SRobert Watsonor
250ea039906SRobert Watson.Xr ls 1 .
251ea039906SRobert WatsonWhen the mode is modified on an object that has a mask entry, the
252ea039906SRobert Watsonchanges applied to the group bits will actually be applied to the
253ea039906SRobert Watsonmask entry.
254ea039906SRobert WatsonThese semantics provide for greater application compatibility:
255ea039906SRobert Watsonapplications modifying the mode instead of the ACL will see
256ea039906SRobert Watsonconservative behavior, limiting the effective rights granted by all
257ea039906SRobert Watsonof the additional user and group entries; this occurs in programs
258ea039906SRobert Watsonsuch as
259ea039906SRobert Watson.Xr chmod 1 .
260ea039906SRobert Watson.Pp
26143960f15SRobert WatsonACL entries applied from a file using the
26243960f15SRobert Watson.Fl M
26343960f15SRobert Watsonor
26443960f15SRobert Watson.Fl X
26543960f15SRobert Watsonoptions shall be of the following form: one ACL entry per line, as
26603035079SRuslan Ermilovpreviously specified; whitespace is ignored; any text after a
26703035079SRuslan Ermilov.Ql #
26803035079SRuslan Ermilovis ignored (comments).
26943960f15SRobert Watson.Pp
2703f221878SEdward Tomasz NapieralaWhen POSIX.1e ACL entries are evaluated, the access check algorithm checks
27143960f15SRobert Watsonthe ACL entries in the following order: file owner,
27203035079SRuslan Ermilov.Dq Li user
27343960f15SRobert WatsonACL entries, file owning group,
27403035079SRuslan Ermilov.Dq Li group
27543960f15SRobert WatsonACL entries, and
27603035079SRuslan Ermilov.Dq Li other
27743960f15SRobert WatsonACL entry.
278458ad6cbSChris D. Faulhaber.Pp
279458ad6cbSChris D. FaulhaberMultiple ACL entries specified on the command line are
280458ad6cbSChris D. Faulhaberseparated by commas.
281bc068d93SChristian S.J. Peron.Pp
282bc068d93SChristian S.J. PeronIt is possible for files and directories to inherit ACL entries from their
283f9655da0SChristian S.J. Peronparent directory.
284f9655da0SChristian S.J. PeronThis is accomplished through the use of the default ACL.
285bc068d93SChristian S.J. PeronIt should be noted that before you can specify a default ACL, the mandatory
286f9655da0SChristian S.J. PeronACL entries for user, group, other and mask must be set.
287f9655da0SChristian S.J. PeronFor more details see the examples below.
288f9655da0SChristian S.J. PeronDefault ACLs can be created by using
289bc068d93SChristian S.J. Peron.Fl d .
2903f221878SEdward Tomasz Napierala.Sh NFSv4 ACL ENTRIES
2913f221878SEdward Tomasz NapieralaAn NFSv4 ACL entry contains four or five colon-separated fields: an ACL tag,
2923f221878SEdward Tomasz Napieralaan ACL qualifier (only for
2933f221878SEdward Tomasz Napierala.Dq Li user
2943f221878SEdward Tomasz Napieralaand
2953f221878SEdward Tomasz Napierala.Dq Li group
2963f221878SEdward Tomasz Napieralatags), discretionary access permissions, ACL inheritance flags, and ACL type:
2973f221878SEdward Tomasz Napierala.Bl -tag -width indent
2983f221878SEdward Tomasz Napierala.It Ar "ACL tag"
2993f221878SEdward Tomasz NapieralaThe ACL tag specifies the ACL entry type and consists of
3003f221878SEdward Tomasz Napieralaone of the following:
3013f221878SEdward Tomasz Napierala.Dq Li user
3023f221878SEdward Tomasz Napieralaor
3033f221878SEdward Tomasz Napierala.Ql u
3043f221878SEdward Tomasz Napieralaspecifying the access
3053f221878SEdward Tomasz Napieralagranted to the specified user;
3063f221878SEdward Tomasz Napierala.Dq Li group
3073f221878SEdward Tomasz Napieralaor
3083f221878SEdward Tomasz Napierala.Ql g
3093f221878SEdward Tomasz Napieralaspecifying the access granted to the specified group;
3103f221878SEdward Tomasz Napierala.Dq Li owner@
3113f221878SEdward Tomasz Napieralaspecifying the access granted to the owner of the file;
3123f221878SEdward Tomasz Napierala.Dq Li group@
3133f221878SEdward Tomasz Napieralaspecifying the access granted to the file owning group;
3143f221878SEdward Tomasz Napierala.Dq Li everyone@
315f3aff7c9SBenjamin Kadukspecifying everyone.
316f3aff7c9SBenjamin KadukNote that
3173f221878SEdward Tomasz Napierala.Dq Li everyone@
3183f221878SEdward Tomasz Napieralais not the same as traditional Unix
3193f221878SEdward Tomasz Napierala.Dq Li other
3203f221878SEdward Tomasz Napierala- it means,
3213f221878SEdward Tomasz Napieralaliterally, everyone, including file owner and owning group.
3223f221878SEdward Tomasz Napierala.It Ar "ACL qualifier"
3233f221878SEdward Tomasz NapieralaThe ACL qualifier field describes the user or group associated with
3243f221878SEdward Tomasz Napieralathe ACL entry.
3253f221878SEdward Tomasz NapieralaIt may consist of one of the following: uid or
326f3aff7c9SBenjamin Kadukuser name, or gid or group name.
327f3aff7c9SBenjamin KadukIn entries whose tag type is one of
3283f221878SEdward Tomasz Napierala.Dq Li owner@ ,
3293f221878SEdward Tomasz Napierala.Dq Li group@ ,
3303f221878SEdward Tomasz Napieralaor
3313f221878SEdward Tomasz Napierala.Dq Li everyone@ ,
332*fef74e99SCeri Daviesthis field is omitted altogether, including the trailing colon.
3333f221878SEdward Tomasz Napierala.It Ar "access permissions"
3343f221878SEdward Tomasz NapieralaAccess permissions may be specified in either short or long form.
3353f221878SEdward Tomasz NapieralaShort and long forms may not be mixed.
3363f221878SEdward Tomasz NapieralaPermissions in long form are separated by the
3373f221878SEdward Tomasz Napierala.Ql /
3383f221878SEdward Tomasz Napieralacharacter; in short form, they are concatenated together.
3393f221878SEdward Tomasz NapieralaValid permissions are:
340181b4eebSEdward Tomasz Napierala.Bl -tag -width ".Dv modify_set"
3413f221878SEdward Tomasz Napierala.It Short
3423f221878SEdward Tomasz NapieralaLong
3433f221878SEdward Tomasz Napierala.It r
3443f221878SEdward Tomasz Napieralaread_data
3453f221878SEdward Tomasz Napierala.It w
3463f221878SEdward Tomasz Napieralawrite_data
3473f221878SEdward Tomasz Napierala.It x
3483f221878SEdward Tomasz Napieralaexecute
3493f221878SEdward Tomasz Napierala.It p
3503f221878SEdward Tomasz Napieralaappend_data
3513f221878SEdward Tomasz Napierala.It D
352a3bc22a0SEdward Tomasz Napieraladelete_child
353a3bc22a0SEdward Tomasz Napierala.It d
3543f221878SEdward Tomasz Napieraladelete
3553f221878SEdward Tomasz Napierala.It a
3563f221878SEdward Tomasz Napieralaread_attributes
3573f221878SEdward Tomasz Napierala.It A
3583f221878SEdward Tomasz Napieralawrite_attributes
3593f221878SEdward Tomasz Napierala.It R
3603f221878SEdward Tomasz Napieralaread_xattr
3613f221878SEdward Tomasz Napierala.It W
3623f221878SEdward Tomasz Napieralawrite_xattr
3633f221878SEdward Tomasz Napierala.It c
3643f221878SEdward Tomasz Napieralaread_acl
3653f221878SEdward Tomasz Napierala.It C
3663f221878SEdward Tomasz Napieralawrite_acl
3673f221878SEdward Tomasz Napierala.It o
3683f221878SEdward Tomasz Napieralawrite_owner
36998287002SEdward Tomasz Napierala.It s
3703f221878SEdward Tomasz Napieralasynchronize
3713f221878SEdward Tomasz Napierala.El
372181b4eebSEdward Tomasz Napierala.Pp
373181b4eebSEdward Tomasz NapieralaIn addition, the following permission sets may be used:
374181b4eebSEdward Tomasz Napierala.Bl -tag -width ".Dv modify_set"
375181b4eebSEdward Tomasz Napierala.It Set
376181b4eebSEdward Tomasz NapieralaPermissions
377181b4eebSEdward Tomasz Napierala.It full_set
378181b4eebSEdward Tomasz Napieralaall permissions, as shown above
379181b4eebSEdward Tomasz Napierala.It modify_set
380181b4eebSEdward Tomasz Napieralaall permissions except write_acl and write_owner
381181b4eebSEdward Tomasz Napierala.It read_set
382181b4eebSEdward Tomasz Napieralaread_data, read_attributes, read_xattr and read_acl
383181b4eebSEdward Tomasz Napierala.It write_set
384181b4eebSEdward Tomasz Napieralawrite_data, append_data, write_attributes and write_xattr
385181b4eebSEdward Tomasz Napierala.El
3863f221878SEdward Tomasz Napierala.It Ar "ACL inheritance flags"
3873f221878SEdward Tomasz NapieralaInheritance flags may be specified in either short or long form.
3883f221878SEdward Tomasz NapieralaShort and long forms may not be mixed.
3893f221878SEdward Tomasz NapieralaAccess flags in long form are separated by the
3903f221878SEdward Tomasz Napierala.Ql /
3913f221878SEdward Tomasz Napieralacharacter; in short form, they are concatenated together.
3923f221878SEdward Tomasz NapieralaValid inheritance flags are:
3933f221878SEdward Tomasz Napierala.Bl -tag -width ".Dv short"
3943f221878SEdward Tomasz Napierala.It Short
3953f221878SEdward Tomasz NapieralaLong
3963f221878SEdward Tomasz Napierala.It f
3973f221878SEdward Tomasz Napieralafile_inherit
3983f221878SEdward Tomasz Napierala.It d
3993f221878SEdward Tomasz Napieraladir_inherit
4003f221878SEdward Tomasz Napierala.It i
4013f221878SEdward Tomasz Napieralainherit_only
4023f221878SEdward Tomasz Napierala.It n
4033f221878SEdward Tomasz Napieralano_propagate
40428ffe927SXin LI.It I
40528ffe927SXin LIinherited
4063f221878SEdward Tomasz Napierala.El
4073f221878SEdward Tomasz Napierala.Pp
40828ffe927SXin LIOther than the "inherited" flag, inheritance flags may be only set on directories.
4093f221878SEdward Tomasz Napierala.It Ar "ACL type"
4103f221878SEdward Tomasz NapieralaThe ACL type field is either
4113f221878SEdward Tomasz Napierala.Dq Li allow
4123f221878SEdward Tomasz Napieralaor
4133f221878SEdward Tomasz Napierala.Dq Li deny .
4143f221878SEdward Tomasz Napierala.El
4153f221878SEdward Tomasz Napierala.Pp
4163f221878SEdward Tomasz NapieralaACL entries applied from a file using the
4173f221878SEdward Tomasz Napierala.Fl M
4183f221878SEdward Tomasz Napieralaor
4193f221878SEdward Tomasz Napierala.Fl X
4203f221878SEdward Tomasz Napieralaoptions shall be of the following form: one ACL entry per line, as
4213f221878SEdward Tomasz Napieralapreviously specified; whitespace is ignored; any text after a
4223f221878SEdward Tomasz Napierala.Ql #
4233f221878SEdward Tomasz Napieralais ignored (comments).
4243f221878SEdward Tomasz Napierala.Pp
4253f221878SEdward Tomasz NapieralaNFSv4 ACL entries are evaluated in their visible order.
4263f221878SEdward Tomasz Napierala.Pp
4273f221878SEdward Tomasz NapieralaMultiple ACL entries specified on the command line are
4283f221878SEdward Tomasz Napieralaseparated by commas.
429f8992fccSEdward Tomasz Napierala.Pp
430f8992fccSEdward Tomasz NapieralaNote that the file owner is always granted the read_acl, write_acl,
431f8992fccSEdward Tomasz Napieralaread_attributes, and write_attributes permissions, even if the ACL
432f8992fccSEdward Tomasz Napieralawould deny it.
4336fca4c7cSRuslan Ermilov.Sh EXIT STATUS
434d628d776SRuslan Ermilov.Ex -std
43543960f15SRobert Watson.Sh EXAMPLES
436bc068d93SChristian S.J. Peron.Dl setfacl -d -m u::rwx,g::rx,o::rx,mask::rwx dir
437bc068d93SChristian S.J. Peron.Dl setfacl -d -m g:admins:rwx dir
438bc068d93SChristian S.J. Peron.Pp
4393f221878SEdward Tomasz NapieralaThe first command sets the mandatory elements of the POSIX.1e default ACL.
440f9655da0SChristian S.J. PeronThe second command specifies that users in group admins can have read, write, and execute
441f9655da0SChristian S.J. Peronpermissions for directory named "dir".
442f9655da0SChristian S.J. PeronIt should be noted that any files or directories created underneath "dir" will
443f9655da0SChristian S.J. Peroninherit these default ACLs upon creation.
444bc068d93SChristian S.J. Peron.Pp
44543960f15SRobert Watson.Dl setfacl -m u::rwx,g:mail:rw file
44643960f15SRobert Watson.Pp
44743960f15SRobert WatsonSets read, write, and execute permissions for the
44843960f15SRobert Watson.Pa file
4493f221878SEdward Tomasz Napieralaowner's POSIX.1e ACL entry and read and write permissions for group mail on
45043960f15SRobert Watson.Pa file .
45143960f15SRobert Watson.Pp
4523f221878SEdward Tomasz Napierala.Dl setfacl -m owner@:rwxp::allow,g:mail:rwp::allow file
4533f221878SEdward Tomasz Napierala.Pp
4543f221878SEdward Tomasz NapieralaSemantically equal to the example above, but for NFSv4 ACL.
4553f221878SEdward Tomasz Napierala.Pp
45643960f15SRobert Watson.Dl setfacl -M file1 file2
45743960f15SRobert Watson.Pp
45843960f15SRobert WatsonSets/updates the ACL entries contained in
45943960f15SRobert Watson.Pa file1
46043960f15SRobert Watsonon
46143960f15SRobert Watson.Pa file2 .
46243960f15SRobert Watson.Pp
46343960f15SRobert Watson.Dl setfacl -x g:mail:rw file
46443960f15SRobert Watson.Pp
4653f221878SEdward Tomasz NapieralaRemove the group mail POSIX.1e ACL entry containing read/write permissions
46643960f15SRobert Watsonfrom
46743960f15SRobert Watson.Pa file .
46843960f15SRobert Watson.Pp
4693f221878SEdward Tomasz Napierala.Dl setfacl -x0 file
4703f221878SEdward Tomasz Napierala.Pp
4713f221878SEdward Tomasz NapieralaRemove the first entry from the NFSv4 ACL from
4723f221878SEdward Tomasz Napierala.Pa file .
4733f221878SEdward Tomasz Napierala.Pp
47405da5209SChris D. Faulhaber.Dl setfacl -bn file
47543960f15SRobert Watson.Pp
47605da5209SChris D. FaulhaberRemove all
47705da5209SChris D. Faulhaber.Dq Li access
47805da5209SChris D. FaulhaberACL entries except for the three required from
47943960f15SRobert Watson.Pa file .
48043960f15SRobert Watson.Pp
48143960f15SRobert Watson.Dl getfacl file1 | setfacl -b -n -M - file2
48243960f15SRobert Watson.Pp
48343960f15SRobert WatsonCopy ACL entries from
48443960f15SRobert Watson.Pa file1
48543960f15SRobert Watsonto
48643960f15SRobert Watson.Pa file2 .
48743960f15SRobert Watson.Sh SEE ALSO
48843960f15SRobert Watson.Xr getfacl 1 ,
48943960f15SRobert Watson.Xr acl 3 ,
49043960f15SRobert Watson.Xr getextattr 8 ,
49143960f15SRobert Watson.Xr setextattr 8 ,
49243960f15SRobert Watson.Xr acl 9 ,
49303035079SRuslan Ermilov.Xr extattr 9
49443960f15SRobert Watson.Sh STANDARDS
49543960f15SRobert WatsonThe
49643960f15SRobert Watson.Nm
49703035079SRuslan Ermilovutility is expected to be
49803035079SRuslan Ermilov.Tn IEEE
49903035079SRuslan ErmilovStd 1003.2c compliant.
50043960f15SRobert Watson.Sh HISTORY
50143960f15SRobert WatsonExtended Attribute and Access Control List support was developed
50203035079SRuslan Ermilovas part of the
50303035079SRuslan Ermilov.Tn TrustedBSD
50403035079SRuslan ErmilovProject and introduced in
50543960f15SRobert Watson.Fx 5.0 .
506413f7dafSEdward Tomasz NapieralaNFSv4 ACL support was introduced in
507413f7dafSEdward Tomasz Napierala.Fx 8.1 .
50843960f15SRobert Watson.Sh AUTHORS
509413f7dafSEdward Tomasz Napierala.An -nosplit
51043960f15SRobert WatsonThe
51143960f15SRobert Watson.Nm
51243960f15SRobert Watsonutility was written by
513bd0891ceSBaptiste Daroussin.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
514413f7dafSEdward Tomasz NapieralaNFSv4 ACL support was implemented by
515bd0891ceSBaptiste Daroussin.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .
516