xref: /freebsd/lib/libc/posix1e/acl.3 (revision 20c61a7c518b9c2f451118913e10a1525ad0b578)
1a889d1fbSRobert Watson.\"-
2963b8cdcSRobert Watson.\" Copyright (c) 2000, 2001, 2002 Robert N. M. Watson
3a889d1fbSRobert Watson.\" All rights reserved.
4a889d1fbSRobert Watson.\"
56394f703SRobert Watson.\" This software was developed by Robert Watson for the TrustedBSD Project.
66394f703SRobert Watson.\"
7a889d1fbSRobert Watson.\" Redistribution and use in source and binary forms, with or without
8a889d1fbSRobert Watson.\" modification, are permitted provided that the following conditions
9a889d1fbSRobert Watson.\" are met:
10a889d1fbSRobert Watson.\" 1. Redistributions of source code must retain the above copyright
11a889d1fbSRobert Watson.\"    notice, this list of conditions and the following disclaimer.
12a889d1fbSRobert Watson.\" 2. Redistributions in binary form must reproduce the above copyright
13a889d1fbSRobert Watson.\"    notice, this list of conditions and the following disclaimer in the
14a889d1fbSRobert Watson.\"    documentation and/or other materials provided with the distribution.
15a889d1fbSRobert Watson.\"
16a889d1fbSRobert Watson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17a889d1fbSRobert Watson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18a889d1fbSRobert Watson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19a889d1fbSRobert Watson.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20a889d1fbSRobert Watson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21a889d1fbSRobert Watson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22a889d1fbSRobert Watson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23a889d1fbSRobert Watson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24a889d1fbSRobert Watson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25a889d1fbSRobert Watson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26a889d1fbSRobert Watson.\" SUCH DAMAGE.
27a889d1fbSRobert Watson.\"
28a889d1fbSRobert Watson.\" $FreeBSD$
29a889d1fbSRobert Watson.\"
30*20c61a7cSKyle Evans.Dd May 8, 2023
31a889d1fbSRobert Watson.Dt ACL 3
32a307d598SRuslan Ermilov.Os
33a889d1fbSRobert Watson.Sh NAME
34c32381adSMike Pritchard.Nm acl
3562bf3533SEdward Tomasz Napierala.Nd introduction to the POSIX.1e/NFSv4 ACL security API
36f75b050cSAlexey Zelkin.Sh LIBRARY
3731acc836SRuslan Ermilov.Lb libc
38a889d1fbSRobert Watson.Sh SYNOPSIS
3932eef9aeSRuslan Ermilov.In sys/types.h
4032eef9aeSRuslan Ermilov.In sys/acl.h
41a889d1fbSRobert Watson.Sh DESCRIPTION
42a21c3aa0SRobert Watson.Fx
43a21c3aa0SRobert Watsonpermits file systems to export Access Control Lists via the VFS, and
44a21c3aa0SRobert Watsonprovides a library for userland access to and manipulation of these ACLs.
4562bf3533SEdward Tomasz Napierala.Fx
4662bf3533SEdward Tomasz Napieralasupports POSIX.1e and NFSv4 ACLs, but
4762bf3533SEdward Tomasz Napieralanot all file systems provide support for ACLs, and some may require that
4857bd0fc6SJens SchweikhardtACL support be explicitly enabled by the administrator.
49a21c3aa0SRobert WatsonThe library calls include routines to allocate, duplicate, retrieve, set,
50a21c3aa0SRobert Watsonand validate ACLs associated with file objects.
51a889d1fbSRobert WatsonAs well as the POSIX.1e routines, there are a number of non-portable
5262bf3533SEdward Tomasz Napieralaextensions defined that allow for ACL semantics alternative to
5362bf3533SEdward Tomasz NapieralaPOSIX.1e, such as NFSv4.
54a21c3aa0SRobert WatsonWhere routines are non-standard, they are suffixed with _np to indicate that
55a889d1fbSRobert Watsonthey are not portable.
5642635956SRuslan Ermilov.Pp
57a889d1fbSRobert WatsonPOSIX.1e describes a set of ACL manipulation routines to manage the
58a21c3aa0SRobert Watsoncontents of ACLs, as well as their relationships with files; almost
59a21c3aa0SRobert Watsonall of these support routines are implemented in
60a21c3aa0SRobert Watson.Fx .
6142635956SRuslan Ermilov.Pp
62a889d1fbSRobert WatsonAvailable functions, sorted by behavior, include:
63336ee39aSRuslan Ermilov.Bl -tag -width indent
64aa015c8eSEdward Tomasz Napierala.It Fn acl_add_flag_np
65aa015c8eSEdward Tomasz NapieralaThis function is described in
66aa015c8eSEdward Tomasz Napierala.Xr acl_add_flag_np 3 ,
67aa015c8eSEdward Tomasz Napieralaand may be used to add flags to a flagset.
68336ee39aSRuslan Ermilov.It Fn acl_add_perm
696822f9dfSChris D. FaulhaberThis function is described in
706822f9dfSChris D. Faulhaber.Xr acl_add_perm 3 ,
716822f9dfSChris D. Faulhaberand may be used to add permissions to a permission set.
72336ee39aSRuslan Ermilov.It Fn acl_calc_mask
736822f9dfSChris D. FaulhaberThis function is described in
746822f9dfSChris D. Faulhaber.Xr acl_calc_mask 3 ,
756822f9dfSChris D. Faulhaberand may be used to calculate and set the permissions associated with
76336ee39aSRuslan Ermilovthe
77336ee39aSRuslan Ermilov.Dv ACL_MASK
78336ee39aSRuslan Ermiloventry.
79aa015c8eSEdward Tomasz Napierala.It Fn acl_clear_flags_np
80aa015c8eSEdward Tomasz NapieralaThis function is described in
81aa015c8eSEdward Tomasz Napierala.Xr acl_clear_flags_np 3 ,
82aa015c8eSEdward Tomasz Napieralaand may be used to clear all flags from a flagset.
83336ee39aSRuslan Ermilov.It Fn acl_clear_perms
846822f9dfSChris D. FaulhaberThis function is described in
856822f9dfSChris D. Faulhaber.Xr acl_clear_perms 3 ,
866822f9dfSChris D. Faulhaberand may be used to clear all permissions from a permission set.
87336ee39aSRuslan Ermilov.It Fn acl_copy_entry
886822f9dfSChris D. FaulhaberThis function is described in
896822f9dfSChris D. Faulhaber.Xr acl_copy_entry 3 ,
906822f9dfSChris D. Faulhaberand may be used to copy the contents of an ACL entry.
91aa015c8eSEdward Tomasz Napierala.It Xo
92aa015c8eSEdward Tomasz Napierala.Fn acl_create_entry ,
93aa015c8eSEdward Tomasz Napierala.Fn acl_create_entry_np
94aa015c8eSEdward Tomasz Napierala.Xc
95aa015c8eSEdward Tomasz NapieralaThese functions are described in
966822f9dfSChris D. Faulhaber.Xr acl_create_entry 3 ,
976822f9dfSChris D. Faulhaberand may be used to create an empty entry in an ACL.
98336ee39aSRuslan Ermilov.It Xo
99a889d1fbSRobert Watson.Fn acl_delete_def_file ,
1006394f703SRobert Watson.Fn acl_delete_def_link_np ,
1016394f703SRobert Watson.Fn acl_delete_fd_np ,
102a889d1fbSRobert Watson.Fn acl_delete_file_np ,
1036394f703SRobert Watson.Fn acl_delete_link_np
104336ee39aSRuslan Ermilov.Xc
105a889d1fbSRobert WatsonThese functions are described in
106a889d1fbSRobert Watson.Xr acl_delete 3 ,
107a889d1fbSRobert Watsonand may be used to delete ACLs from file system objects.
108aa015c8eSEdward Tomasz Napierala.It Xo
109aa015c8eSEdward Tomasz Napierala.Fn acl_delete_entry ,
110aa015c8eSEdward Tomasz Napierala.Fn acl_delete_entry_np ,
111aa015c8eSEdward Tomasz Napierala.Xc
112aa015c8eSEdward Tomasz NapieralaThis functions are described in
1136822f9dfSChris D. Faulhaber.Xr acl_delete_entry 3 ,
1146822f9dfSChris D. Faulhaberand may be used to delete an entry from an ACL.
115aa015c8eSEdward Tomasz Napierala.It Fn acl_delete_flag_np
116aa015c8eSEdward Tomasz NapieralaThis function is described in
117aa015c8eSEdward Tomasz Napierala.Xr acl_delete_flag_np 3 ,
118aa015c8eSEdward Tomasz Napieralaand may be used to delete flags from a flagset.
119336ee39aSRuslan Ermilov.It Fn acl_delete_perm
1206822f9dfSChris D. FaulhaberThis function is described in
1216822f9dfSChris D. Faulhaber.Xr acl_delete_perm 3 ,
1226822f9dfSChris D. Faulhaberand may be used to delete permissions from a permset.
123336ee39aSRuslan Ermilov.It Fn acl_dup
1246822f9dfSChris D. FaulhaberThis function is described in
1256822f9dfSChris D. Faulhaber.Xr acl_dup 3 ,
1266822f9dfSChris D. Faulhaberand may be used to duplicate an ACL structure.
127336ee39aSRuslan Ermilov.It Fn acl_free
128a889d1fbSRobert WatsonThis function is described in
129a889d1fbSRobert Watson.Xr acl_free 3 ,
130a889d1fbSRobert Watsonand may be used to free userland working ACL storage.
131336ee39aSRuslan Ermilov.It Fn acl_from_text
132a889d1fbSRobert WatsonThis function is described in
133a889d1fbSRobert Watson.Xr acl_from_text 3 ,
134a889d1fbSRobert Watsonand may be used to convert a text-form ACL into working ACL state, if
135b372d0d8SEdward Tomasz Napieralathe ACL has POSIX.1e or NFSv4 semantics.
136ce157d5cSEdward Tomasz Napierala.It Fn acl_get_brand_np
137ce157d5cSEdward Tomasz NapieralaThis function is described in
138ce157d5cSEdward Tomasz Napierala.Xr acl_get_brand_np 3
139ce157d5cSEdward Tomasz Napieralaand may be used to determine whether the ACL has POSIX.1e or NFSv4 semantics.
14021aaa49cSChris D. Faulhaber.It Fn acl_get_entry
14121aaa49cSChris D. FaulhaberThis function is described in
14221aaa49cSChris D. Faulhaber.Xr acl_get_entry 3 ,
14321aaa49cSChris D. Faulhaberand may be used to retrieve a designated ACL entry from an ACL.
144336ee39aSRuslan Ermilov.It Xo
145a889d1fbSRobert Watson.Fn acl_get_fd ,
1466394f703SRobert Watson.Fn acl_get_fd_np ,
1476394f703SRobert Watson.Fn acl_get_file ,
1486394f703SRobert Watson.Fn acl_get_link_np
149336ee39aSRuslan Ermilov.Xc
150a889d1fbSRobert WatsonThese functions are described in
151a889d1fbSRobert Watson.Xr acl_get 3 ,
152a889d1fbSRobert Watsonand may be used to retrieve ACLs from file system objects.
153aa015c8eSEdward Tomasz Napierala.It Fn acl_get_entry_type_np
154aa015c8eSEdward Tomasz NapieralaThis function is described in
155aa015c8eSEdward Tomasz Napierala.Xr acl_get_entry_type_np 3 ,
156aa015c8eSEdward Tomasz Napieralaand may be used to retrieve an ACL type from an ACL entry.
157aa015c8eSEdward Tomasz Napierala.It Fn acl_get_flagset_np
158aa015c8eSEdward Tomasz NapieralaThis function is described in
159aa015c8eSEdward Tomasz Napierala.Xr acl_get_flagset_np 3 ,
160aa015c8eSEdward Tomasz Napieralaand may be used to retrieve a flagset from an ACL entry.
161*20c61a7cSKyle Evans.It Fn acl_get_perm_np
162*20c61a7cSKyle EvansThis function is described in
163*20c61a7cSKyle Evans.Xr acl_get_perm_np 3 ,
164*20c61a7cSKyle Evansand may be used to check if a permission is set in a permset.
165336ee39aSRuslan Ermilov.It Fn acl_get_permset
1666822f9dfSChris D. FaulhaberThis function is described in
1676822f9dfSChris D. Faulhaber.Xr acl_get_permset 3 ,
1686822f9dfSChris D. Faulhaberand may be used to retrieve a permset from an ACL entry.
169336ee39aSRuslan Ermilov.It Fn acl_get_qualifier
1706822f9dfSChris D. FaulhaberThis function is described in
1716822f9dfSChris D. Faulhaber.Xr acl_get_qualifier 3 ,
1726822f9dfSChris D. Faulhaberand may be used to retrieve the qualifier from an ACL entry.
173336ee39aSRuslan Ermilov.It Fn acl_get_tag_type
1746822f9dfSChris D. FaulhaberThis function is described in
1756822f9dfSChris D. Faulhaber.Xr acl_get_tag_type 3 ,
1766822f9dfSChris D. Faulhaberand may be used to retrieve the tag type from an ACL entry.
177336ee39aSRuslan Ermilov.It Fn acl_init
178a889d1fbSRobert WatsonThis function is described in
179a889d1fbSRobert Watson.Xr acl_init 3 ,
180a889d1fbSRobert Watsonand may be used to allocate a fresh (empty) ACL structure.
181aa015c8eSEdward Tomasz Napierala.It Fn acl_is_trivial_np
182aa015c8eSEdward Tomasz NapieralaThis function is described in
183aa015c8eSEdward Tomasz Napierala.Xr acl_is_trivial_np 3 ,
184aa015c8eSEdward Tomasz Napieralaand may be used to find out whether ACL is trivial.
185336ee39aSRuslan Ermilov.It Xo
186a889d1fbSRobert Watson.Fn acl_set_fd ,
1876394f703SRobert Watson.Fn acl_set_fd_np ,
1886394f703SRobert Watson.Fn acl_set_file ,
1896394f703SRobert Watson.Fn acl_set_link_np
190336ee39aSRuslan Ermilov.Xc
191c32381adSMike PritchardThese functions are described in
192a889d1fbSRobert Watson.Xr acl_set 3 ,
193a889d1fbSRobert Watsonand may be used to assign an ACL to a file system object.
194aa015c8eSEdward Tomasz Napierala.It Fn acl_set_entry_type_np
195aa015c8eSEdward Tomasz NapieralaThis function is described in
196aa015c8eSEdward Tomasz Napierala.Xr acl_set_entry_type_np 3 ,
197aa015c8eSEdward Tomasz Napieralaand may be used to set the ACL type of an ACL entry.
198aa015c8eSEdward Tomasz Napierala.It Fn acl_set_flagset_np
199aa015c8eSEdward Tomasz NapieralaThis function is described in
200aa015c8eSEdward Tomasz Napierala.Xr acl_set_flagset_np 3 ,
201aa015c8eSEdward Tomasz Napieralaand may be used to set the flags of an ACL entry from a flagset.
202336ee39aSRuslan Ermilov.It Fn acl_set_permset
2036822f9dfSChris D. FaulhaberThis function is described in
2046822f9dfSChris D. Faulhaber.Xr acl_set_permset 3 ,
2056822f9dfSChris D. Faulhaberand may be used to set the permissions of an ACL entry from a permset.
206336ee39aSRuslan Ermilov.It Fn acl_set_qualifier
2076822f9dfSChris D. FaulhaberThis function is described in
2086822f9dfSChris D. Faulhaber.Xr acl_set_qualifier 3 ,
2096822f9dfSChris D. Faulhaberand may be used to set the qualifier of an ACL.
210336ee39aSRuslan Ermilov.It Fn acl_set_tag_type
2116822f9dfSChris D. FaulhaberThis function is described in
2126822f9dfSChris D. Faulhaber.Xr acl_set_tag_type 3 ,
2136822f9dfSChris D. Faulhaberand may be used to set the tag type of an ACL.
214aa015c8eSEdward Tomasz Napierala.It Fn acl_strip_np
215a889d1fbSRobert WatsonThis function is described in
216de19f226SEdward Tomasz Napierala.Xr acl_strip_np 3 ,
217aa015c8eSEdward Tomasz Napieralaand may be used to remove extended entries from an ACL.
218aa015c8eSEdward Tomasz Napierala.It Xo
219aa015c8eSEdward Tomasz Napierala.Fn acl_to_text ,
220aa015c8eSEdward Tomasz Napierala.Fn acl_to_text_np
221aa015c8eSEdward Tomasz Napierala.Xc
222aa015c8eSEdward Tomasz NapieralaThese functions are described in
223a889d1fbSRobert Watson.Xr acl_to_text 3 ,
224b372d0d8SEdward Tomasz Napieralaand may be used to generate a text-form of a POSIX.1e or NFSv4 semantics ACL.
225336ee39aSRuslan Ermilov.It Xo
226a889d1fbSRobert Watson.Fn acl_valid ,
2276394f703SRobert Watson.Fn acl_valid_fd_np ,
228a889d1fbSRobert Watson.Fn acl_valid_file_np ,
2296394f703SRobert Watson.Fn acl_valid_link_np
230336ee39aSRuslan Ermilov.Xc
231336ee39aSRuslan ErmilovThese functions are described in
232a889d1fbSRobert Watson.Xr acl_valid 3 ,
233a889d1fbSRobert Watsonand may be used to validate an ACL as correct POSIX.1e-semantics, or
234a889d1fbSRobert Watsonas appropriate for a particular file system object regardless of semantics.
235336ee39aSRuslan Ermilov.El
23642635956SRuslan Ermilov.Pp
237a889d1fbSRobert WatsonDocumentation of the internal kernel interfaces backing these calls may
238a889d1fbSRobert Watsonbe found in
239a889d1fbSRobert Watson.Xr acl 9 .
240a889d1fbSRobert WatsonThe syscalls between the internal interfaces and the public library
241a21c3aa0SRobert Watsonroutines may change over time, and as such are not documented.
242a21c3aa0SRobert WatsonThey are not intended to be called directly without going through the
243a21c3aa0SRobert Watsonlibrary.
2446822f9dfSChris D. Faulhaber.Sh SEE ALSO
245963b8cdcSRobert Watson.Xr getfacl 1 ,
246963b8cdcSRobert Watson.Xr setfacl 1 ,
247aa015c8eSEdward Tomasz Napierala.Xr acl_add_flag_np 3 ,
2486822f9dfSChris D. Faulhaber.Xr acl_add_perm 3 ,
2496822f9dfSChris D. Faulhaber.Xr acl_calc_mask 3 ,
250aa015c8eSEdward Tomasz Napierala.Xr acl_clear_flags_np 3 ,
2516822f9dfSChris D. Faulhaber.Xr acl_clear_perms 3 ,
2526822f9dfSChris D. Faulhaber.Xr acl_copy_entry 3 ,
2536822f9dfSChris D. Faulhaber.Xr acl_create_entry 3 ,
2546822f9dfSChris D. Faulhaber.Xr acl_delete_entry 3 ,
255aa015c8eSEdward Tomasz Napierala.Xr acl_delete_flag_np 3 ,
2566822f9dfSChris D. Faulhaber.Xr acl_delete_perm 3 ,
2576822f9dfSChris D. Faulhaber.Xr acl_dup 3 ,
2586822f9dfSChris D. Faulhaber.Xr acl_free 3 ,
2596822f9dfSChris D. Faulhaber.Xr acl_from_text 3 ,
2606822f9dfSChris D. Faulhaber.Xr acl_get 3 ,
261ce157d5cSEdward Tomasz Napierala.Xr acl_get_brand_np 3 ,
262aa015c8eSEdward Tomasz Napierala.Xr acl_get_entry_type_np 3 ,
263aa015c8eSEdward Tomasz Napierala.Xr acl_get_flagset_np 3 ,
264*20c61a7cSKyle Evans.Xr acl_get_perm_np 3 ,
2656822f9dfSChris D. Faulhaber.Xr acl_get_permset 3 ,
2666822f9dfSChris D. Faulhaber.Xr acl_get_qualifier 3 ,
2676822f9dfSChris D. Faulhaber.Xr acl_get_tag_type 3 ,
2686822f9dfSChris D. Faulhaber.Xr acl_init 3 ,
269aa015c8eSEdward Tomasz Napierala.Xr acl_is_trivial_np 3 ,
2706822f9dfSChris D. Faulhaber.Xr acl_set 3 ,
271aa015c8eSEdward Tomasz Napierala.Xr acl_set_entry_type_np 3 ,
272aa015c8eSEdward Tomasz Napierala.Xr acl_set_flagset_np 3 ,
2736822f9dfSChris D. Faulhaber.Xr acl_set_permset 3 ,
2746822f9dfSChris D. Faulhaber.Xr acl_set_qualifier 3 ,
2756822f9dfSChris D. Faulhaber.Xr acl_set_tag_type 3 ,
276aa015c8eSEdward Tomasz Napierala.Xr acl_strip_np 3 ,
2776822f9dfSChris D. Faulhaber.Xr acl_to_text 3 ,
2786822f9dfSChris D. Faulhaber.Xr acl_valid 3 ,
2795521ff5aSRuslan Ermilov.Xr posix1e 3 ,
2805521ff5aSRuslan Ermilov.Xr acl 9
2816822f9dfSChris D. Faulhaber.Sh STANDARDS
282a889d1fbSRobert WatsonPOSIX.1e assigns security labels to all objects, extending the security
283a21c3aa0SRobert Watsonfunctionality described in POSIX.1.
284a21c3aa0SRobert WatsonThese additional labels provide fine-grained discretionary access control,
285a21c3aa0SRobert Watsonfine-grained capabilities, and labels necessary for mandatory access
286a21c3aa0SRobert Watsoncontrol.
287a21c3aa0SRobert WatsonPOSIX.2c describes a set of userland utilities for manipulating these
288a21c3aa0SRobert Watsonlabels.
2896822f9dfSChris D. Faulhaber.Pp
290a21c3aa0SRobert WatsonPOSIX.1e is described in IEEE POSIX.1e draft 17.
291a21c3aa0SRobert WatsonDiscussion of the draft continues on the cross-platform POSIX.1e
292a21c3aa0SRobert Watsonimplementation mailing list.
293a21c3aa0SRobert WatsonTo join this list, see the
294c32381adSMike Pritchard.Fx
295a21c3aa0SRobert WatsonPOSIX.1e implementation page for more information.
296a889d1fbSRobert Watson.Sh HISTORY
297c32381adSMike PritchardPOSIX.1e support was introduced in
298a21c3aa0SRobert Watson.Fx 4.0 ;
299a21c3aa0SRobert Watson.Fx 5.0
300a21c3aa0SRobert Watsonwas the first version to include a complete ACL implementation based
301963b8cdcSRobert Watsonon extended attributes for the UFS and UFS2 file systems.
30262bf3533SEdward Tomasz NapieralaNFSv4 ACL support was introduced in
30362bf3533SEdward Tomasz Napierala.Fx 8.0 .
304963b8cdcSRobert Watson.Pp
305d6498251SPhilippe CharnierThe
306963b8cdcSRobert Watson.Xr getfacl 1
307963b8cdcSRobert Watsonand
308963b8cdcSRobert Watson.Xr setfacl 1
309d6498251SPhilippe Charnierutilities describe the user tools that permit direct manipulation of complete
310d6498251SPhilippe Charnierfile ACLs.
311a889d1fbSRobert Watson.Sh AUTHORS
312c32381adSMike Pritchard.An Robert N M Watson
313