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.\" 30ca48e73aSEdward Tomasz Napierala.Dd June 25, 2009 31a889d1fbSRobert Watson.Dt ACL 3 32a307d598SRuslan Ermilov.Os 33a889d1fbSRobert Watson.Sh NAME 34c32381adSMike Pritchard.Nm acl 35c32381adSMike Pritchard.Nd introduction to the POSIX.1e 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. 45a21c3aa0SRobert WatsonNot all file systems provide support for ACLs, and some may require that 4657bd0fc6SJens SchweikhardtACL support be explicitly enabled by the administrator. 47a21c3aa0SRobert WatsonThe library calls include routines to allocate, duplicate, retrieve, set, 48a21c3aa0SRobert Watsonand validate ACLs associated with file objects. 49a889d1fbSRobert WatsonAs well as the POSIX.1e routines, there are a number of non-portable 50a889d1fbSRobert Watsonextensions defined that allow for alternative ACL semantics than the 51f24f1c51SEdward Tomasz NapieralaPOSIX.1e semantics, such as NFSv4, AFS, NTFS, Coda, and NWFS semantics. 52a21c3aa0SRobert WatsonWhere routines are non-standard, they are suffixed with _np to indicate that 53a889d1fbSRobert Watsonthey are not portable. 5442635956SRuslan Ermilov.Pp 55a889d1fbSRobert WatsonPOSIX.1e describes a set of ACL manipulation routines to manage the 56a21c3aa0SRobert Watsoncontents of ACLs, as well as their relationships with files; almost 57a21c3aa0SRobert Watsonall of these support routines are implemented in 58a21c3aa0SRobert Watson.Fx . 5942635956SRuslan Ermilov.Pp 60a889d1fbSRobert WatsonAvailable functions, sorted by behavior, include: 61336ee39aSRuslan Ermilov.Bl -tag -width indent 62aa015c8eSEdward Tomasz Napierala.It Fn acl_add_flag_np 63aa015c8eSEdward Tomasz NapieralaThis function is described in 64aa015c8eSEdward Tomasz Napierala.Xr acl_add_flag_np 3 , 65aa015c8eSEdward Tomasz Napieralaand may be used to add flags to a flagset. 66336ee39aSRuslan Ermilov.It Fn acl_add_perm 676822f9dfSChris D. FaulhaberThis function is described in 686822f9dfSChris D. Faulhaber.Xr acl_add_perm 3 , 696822f9dfSChris D. Faulhaberand may be used to add permissions to a permission set. 70336ee39aSRuslan Ermilov.It Fn acl_calc_mask 716822f9dfSChris D. FaulhaberThis function is described in 726822f9dfSChris D. Faulhaber.Xr acl_calc_mask 3 , 736822f9dfSChris D. Faulhaberand may be used to calculate and set the permissions associated with 74336ee39aSRuslan Ermilovthe 75336ee39aSRuslan Ermilov.Dv ACL_MASK 76336ee39aSRuslan Ermiloventry. 77aa015c8eSEdward Tomasz Napierala.It Fn acl_clear_flags_np 78aa015c8eSEdward Tomasz NapieralaThis function is described in 79aa015c8eSEdward Tomasz Napierala.Xr acl_clear_flags_np 3 , 80aa015c8eSEdward Tomasz Napieralaand may be used to clear all flags from a flagset. 81336ee39aSRuslan Ermilov.It Fn acl_clear_perms 826822f9dfSChris D. FaulhaberThis function is described in 836822f9dfSChris D. Faulhaber.Xr acl_clear_perms 3 , 846822f9dfSChris D. Faulhaberand may be used to clear all permissions from a permission set. 85336ee39aSRuslan Ermilov.It Fn acl_copy_entry 866822f9dfSChris D. FaulhaberThis function is described in 876822f9dfSChris D. Faulhaber.Xr acl_copy_entry 3 , 886822f9dfSChris D. Faulhaberand may be used to copy the contents of an ACL entry. 89aa015c8eSEdward Tomasz Napierala.It Xo 90aa015c8eSEdward Tomasz Napierala.Fn acl_create_entry , 91aa015c8eSEdward Tomasz Napierala.Fn acl_create_entry_np 92aa015c8eSEdward Tomasz Napierala.Xc 93aa015c8eSEdward Tomasz NapieralaThese functions are described in 946822f9dfSChris D. Faulhaber.Xr acl_create_entry 3 , 956822f9dfSChris D. Faulhaberand may be used to create an empty entry in an ACL. 96336ee39aSRuslan Ermilov.It Xo 97a889d1fbSRobert Watson.Fn acl_delete_def_file , 986394f703SRobert Watson.Fn acl_delete_def_link_np , 996394f703SRobert Watson.Fn acl_delete_fd_np , 100a889d1fbSRobert Watson.Fn acl_delete_file_np , 1016394f703SRobert Watson.Fn acl_delete_link_np 102336ee39aSRuslan Ermilov.Xc 103a889d1fbSRobert WatsonThese functions are described in 104a889d1fbSRobert Watson.Xr acl_delete 3 , 105a889d1fbSRobert Watsonand may be used to delete ACLs from file system objects. 106aa015c8eSEdward Tomasz Napierala.It Xo 107aa015c8eSEdward Tomasz Napierala.Fn acl_delete_entry , 108aa015c8eSEdward Tomasz Napierala.Fn acl_delete_entry_np , 109aa015c8eSEdward Tomasz Napierala.Xc 110aa015c8eSEdward Tomasz NapieralaThis functions are described in 1116822f9dfSChris D. Faulhaber.Xr acl_delete_entry 3 , 1126822f9dfSChris D. Faulhaberand may be used to delete an entry from an ACL. 113aa015c8eSEdward Tomasz Napierala.It Fn acl_delete_flag_np 114aa015c8eSEdward Tomasz NapieralaThis function is described in 115aa015c8eSEdward Tomasz Napierala.Xr acl_delete_flag_np 3 , 116aa015c8eSEdward Tomasz Napieralaand may be used to delete flags from a flagset. 117336ee39aSRuslan Ermilov.It Fn acl_delete_perm 1186822f9dfSChris D. FaulhaberThis function is described in 1196822f9dfSChris D. Faulhaber.Xr acl_delete_perm 3 , 1206822f9dfSChris D. Faulhaberand may be used to delete permissions from a permset. 121336ee39aSRuslan Ermilov.It Fn acl_dup 1226822f9dfSChris D. FaulhaberThis function is described in 1236822f9dfSChris D. Faulhaber.Xr acl_dup 3 , 1246822f9dfSChris D. Faulhaberand may be used to duplicate an ACL structure. 125336ee39aSRuslan Ermilov.It Fn acl_free 126a889d1fbSRobert WatsonThis function is described in 127a889d1fbSRobert Watson.Xr acl_free 3 , 128a889d1fbSRobert Watsonand may be used to free userland working ACL storage. 129336ee39aSRuslan Ermilov.It Fn acl_from_text 130a889d1fbSRobert WatsonThis function is described in 131a889d1fbSRobert Watson.Xr acl_from_text 3 , 132a889d1fbSRobert Watsonand may be used to convert a text-form ACL into working ACL state, if 133b372d0d8SEdward Tomasz Napieralathe ACL has POSIX.1e or NFSv4 semantics. 13421aaa49cSChris D. Faulhaber.It Fn acl_get_entry 13521aaa49cSChris D. FaulhaberThis function is described in 13621aaa49cSChris D. Faulhaber.Xr acl_get_entry 3 , 13721aaa49cSChris D. Faulhaberand may be used to retrieve a designated ACL entry from an ACL. 138336ee39aSRuslan Ermilov.It Xo 139a889d1fbSRobert Watson.Fn acl_get_fd , 1406394f703SRobert Watson.Fn acl_get_fd_np , 1416394f703SRobert Watson.Fn acl_get_file , 1426394f703SRobert Watson.Fn acl_get_link_np 143336ee39aSRuslan Ermilov.Xc 144a889d1fbSRobert WatsonThese functions are described in 145a889d1fbSRobert Watson.Xr acl_get 3 , 146a889d1fbSRobert Watsonand may be used to retrieve ACLs from file system objects. 147aa015c8eSEdward Tomasz Napierala.It Fn acl_get_entry_type_np 148aa015c8eSEdward Tomasz NapieralaThis function is described in 149aa015c8eSEdward Tomasz Napierala.Xr acl_get_entry_type_np 3 , 150aa015c8eSEdward Tomasz Napieralaand may be used to retrieve an ACL type from an ACL entry. 151aa015c8eSEdward Tomasz Napierala.It Fn acl_get_flagset_np 152aa015c8eSEdward Tomasz NapieralaThis function is described in 153aa015c8eSEdward Tomasz Napierala.Xr acl_get_flagset_np 3 , 154aa015c8eSEdward Tomasz Napieralaand may be used to retrieve a flagset from an ACL entry. 155336ee39aSRuslan Ermilov.It Fn acl_get_permset 1566822f9dfSChris D. FaulhaberThis function is described in 1576822f9dfSChris D. Faulhaber.Xr acl_get_permset 3 , 1586822f9dfSChris D. Faulhaberand may be used to retrieve a permset from an ACL entry. 159336ee39aSRuslan Ermilov.It Fn acl_get_qualifier 1606822f9dfSChris D. FaulhaberThis function is described in 1616822f9dfSChris D. Faulhaber.Xr acl_get_qualifier 3 , 1626822f9dfSChris D. Faulhaberand may be used to retrieve the qualifier from an ACL entry. 163336ee39aSRuslan Ermilov.It Fn acl_get_tag_type 1646822f9dfSChris D. FaulhaberThis function is described in 1656822f9dfSChris D. Faulhaber.Xr acl_get_tag_type 3 , 1666822f9dfSChris D. Faulhaberand may be used to retrieve the tag type from an ACL entry. 167336ee39aSRuslan Ermilov.It Fn acl_init 168a889d1fbSRobert WatsonThis function is described in 169a889d1fbSRobert Watson.Xr acl_init 3 , 170a889d1fbSRobert Watsonand may be used to allocate a fresh (empty) ACL structure. 171aa015c8eSEdward Tomasz Napierala.It Fn acl_is_trivial_np 172aa015c8eSEdward Tomasz NapieralaThis function is described in 173aa015c8eSEdward Tomasz Napierala.Xr acl_is_trivial_np 3 , 174aa015c8eSEdward Tomasz Napieralaand may be used to find out whether ACL is trivial. 175336ee39aSRuslan Ermilov.It Xo 176a889d1fbSRobert Watson.Fn acl_set_fd , 1776394f703SRobert Watson.Fn acl_set_fd_np , 1786394f703SRobert Watson.Fn acl_set_file , 1796394f703SRobert Watson.Fn acl_set_link_np 180336ee39aSRuslan Ermilov.Xc 181c32381adSMike PritchardThese functions are described in 182a889d1fbSRobert Watson.Xr acl_set 3 , 183a889d1fbSRobert Watsonand may be used to assign an ACL to a file system object. 184aa015c8eSEdward Tomasz Napierala.It Fn acl_set_entry_type_np 185aa015c8eSEdward Tomasz NapieralaThis function is described in 186aa015c8eSEdward Tomasz Napierala.Xr acl_set_entry_type_np 3 , 187aa015c8eSEdward Tomasz Napieralaand may be used to set the ACL type of an ACL entry. 188aa015c8eSEdward Tomasz Napierala.It Fn acl_set_flagset_np 189aa015c8eSEdward Tomasz NapieralaThis function is described in 190aa015c8eSEdward Tomasz Napierala.Xr acl_set_flagset_np 3 , 191aa015c8eSEdward Tomasz Napieralaand may be used to set the flags of an ACL entry from a flagset. 192336ee39aSRuslan Ermilov.It Fn acl_set_permset 1936822f9dfSChris D. FaulhaberThis function is described in 1946822f9dfSChris D. Faulhaber.Xr acl_set_permset 3 , 1956822f9dfSChris D. Faulhaberand may be used to set the permissions of an ACL entry from a permset. 196336ee39aSRuslan Ermilov.It Fn acl_set_qualifier 1976822f9dfSChris D. FaulhaberThis function is described in 1986822f9dfSChris D. Faulhaber.Xr acl_set_qualifier 3 , 1996822f9dfSChris D. Faulhaberand may be used to set the qualifier of an ACL. 200336ee39aSRuslan Ermilov.It Fn acl_set_tag_type 2016822f9dfSChris D. FaulhaberThis function is described in 2026822f9dfSChris D. Faulhaber.Xr acl_set_tag_type 3 , 2036822f9dfSChris D. Faulhaberand may be used to set the tag type of an ACL. 204aa015c8eSEdward Tomasz Napierala.It Fn acl_strip_np 205a889d1fbSRobert WatsonThis function is describe din 206aa015c8eSEdward Tomasz Napierala.Xr acl-strip_np 3 , 207aa015c8eSEdward Tomasz Napieralaand may be used to remove extended entries from an ACL. 208aa015c8eSEdward Tomasz Napierala.It Xo 209aa015c8eSEdward Tomasz Napierala.Fn acl_to_text , 210aa015c8eSEdward Tomasz Napierala.Fn acl_to_text_np 211aa015c8eSEdward Tomasz Napierala.Xc 212aa015c8eSEdward Tomasz NapieralaThese functions are described in 213a889d1fbSRobert Watson.Xr acl_to_text 3 , 214b372d0d8SEdward Tomasz Napieralaand may be used to generate a text-form of a POSIX.1e or NFSv4 semantics ACL. 215336ee39aSRuslan Ermilov.It Xo 216a889d1fbSRobert Watson.Fn acl_valid , 2176394f703SRobert Watson.Fn acl_valid_fd_np , 218a889d1fbSRobert Watson.Fn acl_valid_file_np , 2196394f703SRobert Watson.Fn acl_valid_link_np 220336ee39aSRuslan Ermilov.Xc 221336ee39aSRuslan ErmilovThese functions are described in 222a889d1fbSRobert Watson.Xr acl_valid 3 , 223a889d1fbSRobert Watsonand may be used to validate an ACL as correct POSIX.1e-semantics, or 224a889d1fbSRobert Watsonas appropriate for a particular file system object regardless of semantics. 225336ee39aSRuslan Ermilov.El 22642635956SRuslan Ermilov.Pp 227a889d1fbSRobert WatsonDocumentation of the internal kernel interfaces backing these calls may 228a889d1fbSRobert Watsonbe found in 229a889d1fbSRobert Watson.Xr acl 9 . 230a889d1fbSRobert WatsonThe syscalls between the internal interfaces and the public library 231a21c3aa0SRobert Watsonroutines may change over time, and as such are not documented. 232a21c3aa0SRobert WatsonThey are not intended to be called directly without going through the 233a21c3aa0SRobert Watsonlibrary. 2346822f9dfSChris D. Faulhaber.Sh SEE ALSO 235963b8cdcSRobert Watson.Xr getfacl 1 , 236963b8cdcSRobert Watson.Xr setfacl 1 , 237aa015c8eSEdward Tomasz Napierala.Xr acl_add_flag_np 3 , 2386822f9dfSChris D. Faulhaber.Xr acl_add_perm 3 , 2396822f9dfSChris D. Faulhaber.Xr acl_calc_mask 3 , 240aa015c8eSEdward Tomasz Napierala.Xr acl_clear_flags_np 3 , 2416822f9dfSChris D. Faulhaber.Xr acl_clear_perms 3 , 2426822f9dfSChris D. Faulhaber.Xr acl_copy_entry 3 , 2436822f9dfSChris D. Faulhaber.Xr acl_create_entry 3 , 2446822f9dfSChris D. Faulhaber.Xr acl_delete_entry 3 , 245aa015c8eSEdward Tomasz Napierala.Xr acl_delete_flag_np 3 , 2466822f9dfSChris D. Faulhaber.Xr acl_delete_perm 3 , 2476822f9dfSChris D. Faulhaber.Xr acl_dup 3 , 2486822f9dfSChris D. Faulhaber.Xr acl_free 3 , 2496822f9dfSChris D. Faulhaber.Xr acl_from_text 3 , 2506822f9dfSChris D. Faulhaber.Xr acl_get 3 , 251aa015c8eSEdward Tomasz Napierala.Xr acl_get_entry_type_np 3 , 252aa015c8eSEdward Tomasz Napierala.Xr acl_get_flagset_np 3 , 2536822f9dfSChris D. Faulhaber.Xr acl_get_permset 3 , 2546822f9dfSChris D. Faulhaber.Xr acl_get_qualifier 3 , 2556822f9dfSChris D. Faulhaber.Xr acl_get_tag_type 3 , 2566822f9dfSChris D. Faulhaber.Xr acl_init 3 , 257aa015c8eSEdward Tomasz Napierala.Xr acl_is_trivial_np 3 , 2586822f9dfSChris D. Faulhaber.Xr acl_set 3 , 259aa015c8eSEdward Tomasz Napierala.Xr acl_set_entry_type_np 3 , 260aa015c8eSEdward Tomasz Napierala.Xr acl_set_flagset_np 3 , 2616822f9dfSChris D. Faulhaber.Xr acl_set_permset 3 , 2626822f9dfSChris D. Faulhaber.Xr acl_set_qualifier 3 , 2636822f9dfSChris D. Faulhaber.Xr acl_set_tag_type 3 , 264aa015c8eSEdward Tomasz Napierala.Xr acl_strip_np 3 , 2656822f9dfSChris D. Faulhaber.Xr acl_to_text 3 , 2666822f9dfSChris D. Faulhaber.Xr acl_valid 3 , 2675521ff5aSRuslan Ermilov.Xr posix1e 3 , 2685521ff5aSRuslan Ermilov.Xr acl 9 2696822f9dfSChris D. Faulhaber.Sh STANDARDS 270a889d1fbSRobert WatsonPOSIX.1e assigns security labels to all objects, extending the security 271a21c3aa0SRobert Watsonfunctionality described in POSIX.1. 272a21c3aa0SRobert WatsonThese additional labels provide fine-grained discretionary access control, 273a21c3aa0SRobert Watsonfine-grained capabilities, and labels necessary for mandatory access 274a21c3aa0SRobert Watsoncontrol. 275a21c3aa0SRobert WatsonPOSIX.2c describes a set of userland utilities for manipulating these 276a21c3aa0SRobert Watsonlabels. 2776822f9dfSChris D. Faulhaber.Pp 278a21c3aa0SRobert WatsonPOSIX.1e is described in IEEE POSIX.1e draft 17. 279a21c3aa0SRobert WatsonDiscussion of the draft continues on the cross-platform POSIX.1e 280a21c3aa0SRobert Watsonimplementation mailing list. 281a21c3aa0SRobert WatsonTo join this list, see the 282c32381adSMike Pritchard.Fx 283a21c3aa0SRobert WatsonPOSIX.1e implementation page for more information. 284a889d1fbSRobert Watson.Sh HISTORY 285c32381adSMike PritchardPOSIX.1e support was introduced in 286a21c3aa0SRobert Watson.Fx 4.0 ; 287a21c3aa0SRobert Watson.Fx 5.0 288a21c3aa0SRobert Watsonwas the first version to include a complete ACL implementation based 289963b8cdcSRobert Watsonon extended attributes for the UFS and UFS2 file systems. 290963b8cdcSRobert Watson.Pp 291d6498251SPhilippe CharnierThe 292963b8cdcSRobert Watson.Xr getfacl 1 293963b8cdcSRobert Watsonand 294963b8cdcSRobert Watson.Xr setfacl 1 295d6498251SPhilippe Charnierutilities describe the user tools that permit direct manipulation of complete 296d6498251SPhilippe Charnierfile ACLs. 297a889d1fbSRobert Watson.Sh AUTHORS 298c32381adSMike Pritchard.An Robert N M Watson 299