1a889d1fbSRobert Watson.\"- 2963b8cdcSRobert Watson.\" Copyright (c) 2000, 2001, 2002 Robert N. M. Watson 3a889d1fbSRobert Watson.\" All rights reserved. 4a889d1fbSRobert Watson.\" 5a889d1fbSRobert Watson.\" Redistribution and use in source and binary forms, with or without 6a889d1fbSRobert Watson.\" modification, are permitted provided that the following conditions 7a889d1fbSRobert Watson.\" are met: 8a889d1fbSRobert Watson.\" 1. Redistributions of source code must retain the above copyright 9a889d1fbSRobert Watson.\" notice, this list of conditions and the following disclaimer. 10a889d1fbSRobert Watson.\" 2. Redistributions in binary form must reproduce the above copyright 11a889d1fbSRobert Watson.\" notice, this list of conditions and the following disclaimer in the 12a889d1fbSRobert Watson.\" documentation and/or other materials provided with the distribution. 13a889d1fbSRobert Watson.\" 14a889d1fbSRobert Watson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15a889d1fbSRobert Watson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16a889d1fbSRobert Watson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17a889d1fbSRobert Watson.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18a889d1fbSRobert Watson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19a889d1fbSRobert Watson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20a889d1fbSRobert Watson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21a889d1fbSRobert Watson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22a889d1fbSRobert Watson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23a889d1fbSRobert Watson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24a889d1fbSRobert Watson.\" SUCH DAMAGE. 25a889d1fbSRobert Watson.\" 26a889d1fbSRobert Watson.\" $FreeBSD$ 27a889d1fbSRobert Watson.\" 28a889d1fbSRobert Watson.Dd January 28, 2000 29a889d1fbSRobert Watson.Dt ACL 3 30a307d598SRuslan Ermilov.Os 31a889d1fbSRobert Watson.Sh NAME 32c32381adSMike Pritchard.Nm acl 33c32381adSMike Pritchard.Nd introduction to the POSIX.1e ACL security API 34f75b050cSAlexey Zelkin.Sh LIBRARY 3531acc836SRuslan Ermilov.Lb libc 36a889d1fbSRobert Watson.Sh SYNOPSIS 3732eef9aeSRuslan Ermilov.In sys/types.h 3832eef9aeSRuslan Ermilov.In sys/acl.h 39a889d1fbSRobert Watson.Sh DESCRIPTION 40a21c3aa0SRobert Watson.Fx 41a21c3aa0SRobert Watsonpermits file systems to export Access Control Lists via the VFS, and 42a21c3aa0SRobert Watsonprovides a library for userland access to and manipulation of these ACLs. 43a21c3aa0SRobert WatsonNot all file systems provide support for ACLs, and some may require that 44a21c3aa0SRobert WatsonACL support be explicitely enabled by the administrator. 45a21c3aa0SRobert WatsonThe library calls include routines to allocate, duplicate, retrieve, set, 46a21c3aa0SRobert Watsonand validate ACLs associated with file objects. 47a889d1fbSRobert WatsonAs well as the POSIX.1e routines, there are a number of non-portable 48a889d1fbSRobert Watsonextensions defined that allow for alternative ACL semantics than the 49a21c3aa0SRobert WatsonPOSIX.1e semantics, such as AFS, NTFS, Coda, and NWFS semantics. 50a21c3aa0SRobert WatsonWhere routines are non-standard, they are suffixed with _np to indicate that 51a889d1fbSRobert Watsonthey are not portable. 5242635956SRuslan Ermilov.Pp 53a889d1fbSRobert WatsonPOSIX.1e describes a set of ACL manipulation routines to manage the 54a21c3aa0SRobert Watsoncontents of ACLs, as well as their relationships with files; almost 55a21c3aa0SRobert Watsonall of these support routines are implemented in 56a21c3aa0SRobert Watson.Fx . 5742635956SRuslan Ermilov.Pp 58a889d1fbSRobert WatsonAvailable functions, sorted by behavior, include: 59336ee39aSRuslan Ermilov.Bl -tag -width indent 60336ee39aSRuslan Ermilov.It Fn acl_add_perm 616822f9dfSChris D. FaulhaberThis function is described in 626822f9dfSChris D. Faulhaber.Xr acl_add_perm 3 , 636822f9dfSChris D. Faulhaberand may be used to add permissions to a permission set. 64336ee39aSRuslan Ermilov.It Fn acl_calc_mask 656822f9dfSChris D. FaulhaberThis function is described in 666822f9dfSChris D. Faulhaber.Xr acl_calc_mask 3 , 676822f9dfSChris D. Faulhaberand may be used to calculate and set the permissions associated with 68336ee39aSRuslan Ermilovthe 69336ee39aSRuslan Ermilov.Dv ACL_MASK 70336ee39aSRuslan Ermiloventry. 71336ee39aSRuslan Ermilov.It Fn acl_clear_perms 726822f9dfSChris D. FaulhaberThis function is described in 736822f9dfSChris D. Faulhaber.Xr acl_clear_perms 3 , 746822f9dfSChris D. Faulhaberand may be used to clear all permissions from a permission set. 75336ee39aSRuslan Ermilov.It Fn acl_copy_entry 766822f9dfSChris D. FaulhaberThis function is described in 776822f9dfSChris D. Faulhaber.Xr acl_copy_entry 3 , 786822f9dfSChris D. Faulhaberand may be used to copy the contents of an ACL entry. 79336ee39aSRuslan Ermilov.It Fn acl_create_entry 806822f9dfSChris D. FaulhaberThis function is described in 816822f9dfSChris D. Faulhaber.Xr acl_create_entry 3 , 826822f9dfSChris D. Faulhaberand may be used to create an empty entry in an ACL. 83336ee39aSRuslan Ermilov.It Xo 84a889d1fbSRobert Watson.Fn acl_delete_def_file , 85a889d1fbSRobert Watson.Fn acl_delete_file_np , 86a889d1fbSRobert Watson.Fn acl_delete_fd_np 87336ee39aSRuslan Ermilov.Xc 88a889d1fbSRobert WatsonThese functions are described in 89a889d1fbSRobert Watson.Xr acl_delete 3 , 90a889d1fbSRobert Watsonand may be used to delete ACLs from file system objects. 91336ee39aSRuslan Ermilov.It Fn acl_delete_entry 926822f9dfSChris D. FaulhaberThis function is described in 936822f9dfSChris D. Faulhaber.Xr acl_delete_entry 3 , 946822f9dfSChris D. Faulhaberand may be used to delete an entry from an ACL. 95336ee39aSRuslan Ermilov.It Fn acl_delete_perm 966822f9dfSChris D. FaulhaberThis function is described in 976822f9dfSChris D. Faulhaber.Xr acl_delete_perm 3 , 986822f9dfSChris D. Faulhaberand may be used to delete permissions from a permset. 99336ee39aSRuslan Ermilov.It Fn acl_dup 1006822f9dfSChris D. FaulhaberThis function is described in 1016822f9dfSChris D. Faulhaber.Xr acl_dup 3 , 1026822f9dfSChris D. Faulhaberand may be used to duplicate an ACL structure. 103336ee39aSRuslan Ermilov.It Fn acl_free 104a889d1fbSRobert WatsonThis function is described in 105a889d1fbSRobert Watson.Xr acl_free 3 , 106a889d1fbSRobert Watsonand may be used to free userland working ACL storage. 107336ee39aSRuslan Ermilov.It Fn acl_from_text 108a889d1fbSRobert WatsonThis function is described in 109a889d1fbSRobert Watson.Xr acl_from_text 3 , 110a889d1fbSRobert Watsonand may be used to convert a text-form ACL into working ACL state, if 111a889d1fbSRobert Watsonthe ACL has POSIX.1e semantics. 11221aaa49cSChris D. Faulhaber.It Fn acl_get_entry 11321aaa49cSChris D. FaulhaberThis function is described in 11421aaa49cSChris D. Faulhaber.Xr acl_get_entry 3 , 11521aaa49cSChris D. Faulhaberand may be used to retrieve a designated ACL entry from an ACL. 116336ee39aSRuslan Ermilov.It Xo 117a889d1fbSRobert Watson.Fn acl_get_file , 118a889d1fbSRobert Watson.Fn acl_get_fd , 119a889d1fbSRobert Watson.Fn acl_get_fd_np 120336ee39aSRuslan Ermilov.Xc 121a889d1fbSRobert WatsonThese functions are described in 122a889d1fbSRobert Watson.Xr acl_get 3 , 123a889d1fbSRobert Watsonand may be used to retrieve ACLs from file system objects. 124336ee39aSRuslan Ermilov.It Fn acl_get_permset 1256822f9dfSChris D. FaulhaberThis function is described in 1266822f9dfSChris D. Faulhaber.Xr acl_get_permset 3 , 1276822f9dfSChris D. Faulhaberand may be used to retrieve a permset from an ACL entry. 128336ee39aSRuslan Ermilov.It Fn acl_get_qualifier 1296822f9dfSChris D. FaulhaberThis function is described in 1306822f9dfSChris D. Faulhaber.Xr acl_get_qualifier 3 , 1316822f9dfSChris D. Faulhaberand may be used to retrieve the qualifier from an ACL entry. 132336ee39aSRuslan Ermilov.It Fn acl_get_tag_type 1336822f9dfSChris D. FaulhaberThis function is described in 1346822f9dfSChris D. Faulhaber.Xr acl_get_tag_type 3 , 1356822f9dfSChris D. Faulhaberand may be used to retrieve the tag type from an ACL entry. 136336ee39aSRuslan Ermilov.It Fn acl_init 137a889d1fbSRobert WatsonThis function is described in 138a889d1fbSRobert Watson.Xr acl_init 3 , 139a889d1fbSRobert Watsonand may be used to allocate a fresh (empty) ACL structure. 140336ee39aSRuslan Ermilov.It Xo 141a889d1fbSRobert Watson.Fn acl_set_file , 142a889d1fbSRobert Watson.Fn acl_set_fd , 143a889d1fbSRobert Watson.Fn acl_set_fd_np 144336ee39aSRuslan Ermilov.Xc 145c32381adSMike PritchardThese functions are described in 146a889d1fbSRobert Watson.Xr acl_set 3 , 147a889d1fbSRobert Watsonand may be used to assign an ACL to a file system object. 148336ee39aSRuslan Ermilov.It Fn acl_set_permset 1496822f9dfSChris D. FaulhaberThis function is described in 1506822f9dfSChris D. Faulhaber.Xr acl_set_permset 3 , 1516822f9dfSChris D. Faulhaberand may be used to set the permissions of an ACL entry from a permset. 152336ee39aSRuslan Ermilov.It Fn acl_set_qualifier 1536822f9dfSChris D. FaulhaberThis function is described in 1546822f9dfSChris D. Faulhaber.Xr acl_set_qualifier 3 , 1556822f9dfSChris D. Faulhaberand may be used to set the qualifier of an ACL. 156336ee39aSRuslan Ermilov.It Fn acl_set_tag_type 1576822f9dfSChris D. FaulhaberThis function is described in 1586822f9dfSChris D. Faulhaber.Xr acl_set_tag_type 3 , 1596822f9dfSChris D. Faulhaberand may be used to set the tag type of an ACL. 160336ee39aSRuslan Ermilov.It Fn acl_to_text 161a889d1fbSRobert WatsonThis function is described in 162a889d1fbSRobert Watson.Xr acl_to_text 3 , 163a889d1fbSRobert Watsonand may be used to generate a text-form of a POSIX.1e semantics ACL. 164336ee39aSRuslan Ermilov.It Xo 165a889d1fbSRobert Watson.Fn acl_valid , 166a889d1fbSRobert Watson.Fn acl_valid_file_np , 167a889d1fbSRobert Watson.Fn acl_valid_fd_np 168336ee39aSRuslan Ermilov.Xc 169336ee39aSRuslan ErmilovThese functions are described in 170a889d1fbSRobert Watson.Xr acl_valid 3 , 171a889d1fbSRobert Watsonand may be used to validate an ACL as correct POSIX.1e-semantics, or 172a889d1fbSRobert Watsonas appropriate for a particular file system object regardless of semantics. 173336ee39aSRuslan Ermilov.El 17442635956SRuslan Ermilov.Pp 175a889d1fbSRobert WatsonDocumentation of the internal kernel interfaces backing these calls may 176a889d1fbSRobert Watsonbe found in 177a889d1fbSRobert Watson.Xr acl 9 . 178a889d1fbSRobert WatsonThe syscalls between the internal interfaces and the public library 179a21c3aa0SRobert Watsonroutines may change over time, and as such are not documented. 180a21c3aa0SRobert WatsonThey are not intended to be called directly without going through the 181a21c3aa0SRobert Watsonlibrary. 1826822f9dfSChris D. Faulhaber.Sh SEE ALSO 183963b8cdcSRobert Watson.Xr getfacl 1 , 184963b8cdcSRobert Watson.Xr setfacl 1 , 1856822f9dfSChris D. Faulhaber.Xr acl_add_perm 3 , 1866822f9dfSChris D. Faulhaber.Xr acl_calc_mask 3 , 1876822f9dfSChris D. Faulhaber.Xr acl_clear_perms 3 , 1886822f9dfSChris D. Faulhaber.Xr acl_copy_entry 3 , 1896822f9dfSChris D. Faulhaber.Xr acl_create_entry 3 , 1906822f9dfSChris D. Faulhaber.Xr acl_delete_entry 3 , 1916822f9dfSChris D. Faulhaber.Xr acl_delete_perm 3 , 1926822f9dfSChris D. Faulhaber.Xr acl_dup 3 , 1936822f9dfSChris D. Faulhaber.Xr acl_free 3 , 1946822f9dfSChris D. Faulhaber.Xr acl_from_text 3 , 1956822f9dfSChris D. Faulhaber.Xr acl_get 3 , 1966822f9dfSChris D. Faulhaber.Xr acl_get_permset 3 , 1976822f9dfSChris D. Faulhaber.Xr acl_get_qualifier 3 , 1986822f9dfSChris D. Faulhaber.Xr acl_get_tag_type 3 , 1996822f9dfSChris D. Faulhaber.Xr acl_init 3 , 2006822f9dfSChris D. Faulhaber.Xr acl_set 3 , 2016822f9dfSChris D. Faulhaber.Xr acl_set_permset 3 , 2026822f9dfSChris D. Faulhaber.Xr acl_set_qualifier 3 , 2036822f9dfSChris D. Faulhaber.Xr acl_set_tag_type 3 , 2046822f9dfSChris D. Faulhaber.Xr acl_to_text 3 , 2056822f9dfSChris D. Faulhaber.Xr acl_valid 3 , 2065521ff5aSRuslan Ermilov.Xr posix1e 3 , 2075521ff5aSRuslan Ermilov.Xr acl 9 2086822f9dfSChris D. Faulhaber.Sh STANDARDS 209a889d1fbSRobert WatsonPOSIX.1e assigns security labels to all objects, extending the security 210a21c3aa0SRobert Watsonfunctionality described in POSIX.1. 211a21c3aa0SRobert WatsonThese additional labels provide fine-grained discretionary access control, 212a21c3aa0SRobert Watsonfine-grained capabilities, and labels necessary for mandatory access 213a21c3aa0SRobert Watsoncontrol. 214a21c3aa0SRobert WatsonPOSIX.2c describes a set of userland utilities for manipulating these 215a21c3aa0SRobert Watsonlabels. 2166822f9dfSChris D. Faulhaber.Pp 217a21c3aa0SRobert WatsonPOSIX.1e is described in IEEE POSIX.1e draft 17. 218a21c3aa0SRobert WatsonDiscussion of the draft continues on the cross-platform POSIX.1e 219a21c3aa0SRobert Watsonimplementation mailing list. 220a21c3aa0SRobert WatsonTo join this list, see the 221c32381adSMike Pritchard.Fx 222a21c3aa0SRobert WatsonPOSIX.1e implementation page for more information. 223a889d1fbSRobert Watson.Sh HISTORY 224c32381adSMike PritchardPOSIX.1e support was introduced in 225a21c3aa0SRobert Watson.Fx 4.0 ; 226a21c3aa0SRobert Watson.Fx 5.0 227a21c3aa0SRobert Watsonwas the first version to include a complete ACL implementation based 228963b8cdcSRobert Watsonon extended attributes for the UFS and UFS2 file systems. 229963b8cdcSRobert Watson.Pp 230963b8cdcSRobert Watson.Xr getfacl 1 231963b8cdcSRobert Watsonand 232963b8cdcSRobert Watson.Xr setfacl 1 233963b8cdcSRobert Watsondescribe the user tools that permit direct manipulation of complete file 234963b8cdcSRobert WatsonACLs. 235a889d1fbSRobert Watson.Sh AUTHORS 236c32381adSMike Pritchard.An Robert N M Watson 237