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.\" 306394f703SRobert Watson.Dd December 18, 2002 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 51a21c3aa0SRobert WatsonPOSIX.1e semantics, such as 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 62336ee39aSRuslan Ermilov.It Fn acl_add_perm 636822f9dfSChris D. FaulhaberThis function is described in 646822f9dfSChris D. Faulhaber.Xr acl_add_perm 3 , 656822f9dfSChris D. Faulhaberand may be used to add permissions to a permission set. 66336ee39aSRuslan Ermilov.It Fn acl_calc_mask 676822f9dfSChris D. FaulhaberThis function is described in 686822f9dfSChris D. Faulhaber.Xr acl_calc_mask 3 , 696822f9dfSChris D. Faulhaberand may be used to calculate and set the permissions associated with 70336ee39aSRuslan Ermilovthe 71336ee39aSRuslan Ermilov.Dv ACL_MASK 72336ee39aSRuslan Ermiloventry. 73336ee39aSRuslan Ermilov.It Fn acl_clear_perms 746822f9dfSChris D. FaulhaberThis function is described in 756822f9dfSChris D. Faulhaber.Xr acl_clear_perms 3 , 766822f9dfSChris D. Faulhaberand may be used to clear all permissions from a permission set. 77336ee39aSRuslan Ermilov.It Fn acl_copy_entry 786822f9dfSChris D. FaulhaberThis function is described in 796822f9dfSChris D. Faulhaber.Xr acl_copy_entry 3 , 806822f9dfSChris D. Faulhaberand may be used to copy the contents of an ACL entry. 81336ee39aSRuslan Ermilov.It Fn acl_create_entry 826822f9dfSChris D. FaulhaberThis function is described in 836822f9dfSChris D. Faulhaber.Xr acl_create_entry 3 , 846822f9dfSChris D. Faulhaberand may be used to create an empty entry in an ACL. 85336ee39aSRuslan Ermilov.It Xo 86a889d1fbSRobert Watson.Fn acl_delete_def_file , 876394f703SRobert Watson.Fn acl_delete_def_link_np , 886394f703SRobert Watson.Fn acl_delete_fd_np , 89a889d1fbSRobert Watson.Fn acl_delete_file_np , 906394f703SRobert Watson.Fn acl_delete_link_np 91336ee39aSRuslan Ermilov.Xc 92a889d1fbSRobert WatsonThese functions are described in 93a889d1fbSRobert Watson.Xr acl_delete 3 , 94a889d1fbSRobert Watsonand may be used to delete ACLs from file system objects. 95336ee39aSRuslan Ermilov.It Fn acl_delete_entry 966822f9dfSChris D. FaulhaberThis function is described in 976822f9dfSChris D. Faulhaber.Xr acl_delete_entry 3 , 986822f9dfSChris D. Faulhaberand may be used to delete an entry from an ACL. 99336ee39aSRuslan Ermilov.It Fn acl_delete_perm 1006822f9dfSChris D. FaulhaberThis function is described in 1016822f9dfSChris D. Faulhaber.Xr acl_delete_perm 3 , 1026822f9dfSChris D. Faulhaberand may be used to delete permissions from a permset. 103336ee39aSRuslan Ermilov.It Fn acl_dup 1046822f9dfSChris D. FaulhaberThis function is described in 1056822f9dfSChris D. Faulhaber.Xr acl_dup 3 , 1066822f9dfSChris D. Faulhaberand may be used to duplicate an ACL structure. 107336ee39aSRuslan Ermilov.It Fn acl_free 108a889d1fbSRobert WatsonThis function is described in 109a889d1fbSRobert Watson.Xr acl_free 3 , 110a889d1fbSRobert Watsonand may be used to free userland working ACL storage. 111336ee39aSRuslan Ermilov.It Fn acl_from_text 112a889d1fbSRobert WatsonThis function is described in 113a889d1fbSRobert Watson.Xr acl_from_text 3 , 114a889d1fbSRobert Watsonand may be used to convert a text-form ACL into working ACL state, if 115a889d1fbSRobert Watsonthe ACL has POSIX.1e semantics. 11621aaa49cSChris D. Faulhaber.It Fn acl_get_entry 11721aaa49cSChris D. FaulhaberThis function is described in 11821aaa49cSChris D. Faulhaber.Xr acl_get_entry 3 , 11921aaa49cSChris D. Faulhaberand may be used to retrieve a designated ACL entry from an ACL. 120336ee39aSRuslan Ermilov.It Xo 121a889d1fbSRobert Watson.Fn acl_get_fd , 1226394f703SRobert Watson.Fn acl_get_fd_np , 1236394f703SRobert Watson.Fn acl_get_file , 1246394f703SRobert Watson.Fn acl_get_link_np 125336ee39aSRuslan Ermilov.Xc 126a889d1fbSRobert WatsonThese functions are described in 127a889d1fbSRobert Watson.Xr acl_get 3 , 128a889d1fbSRobert Watsonand may be used to retrieve ACLs from file system objects. 129336ee39aSRuslan Ermilov.It Fn acl_get_permset 1306822f9dfSChris D. FaulhaberThis function is described in 1316822f9dfSChris D. Faulhaber.Xr acl_get_permset 3 , 1326822f9dfSChris D. Faulhaberand may be used to retrieve a permset from an ACL entry. 133336ee39aSRuslan Ermilov.It Fn acl_get_qualifier 1346822f9dfSChris D. FaulhaberThis function is described in 1356822f9dfSChris D. Faulhaber.Xr acl_get_qualifier 3 , 1366822f9dfSChris D. Faulhaberand may be used to retrieve the qualifier from an ACL entry. 137336ee39aSRuslan Ermilov.It Fn acl_get_tag_type 1386822f9dfSChris D. FaulhaberThis function is described in 1396822f9dfSChris D. Faulhaber.Xr acl_get_tag_type 3 , 1406822f9dfSChris D. Faulhaberand may be used to retrieve the tag type from an ACL entry. 141336ee39aSRuslan Ermilov.It Fn acl_init 142a889d1fbSRobert WatsonThis function is described in 143a889d1fbSRobert Watson.Xr acl_init 3 , 144a889d1fbSRobert Watsonand may be used to allocate a fresh (empty) ACL structure. 145336ee39aSRuslan Ermilov.It Xo 146a889d1fbSRobert Watson.Fn acl_set_fd , 1476394f703SRobert Watson.Fn acl_set_fd_np , 1486394f703SRobert Watson.Fn acl_set_file , 1496394f703SRobert Watson.Fn acl_set_link_np 150336ee39aSRuslan Ermilov.Xc 151c32381adSMike PritchardThese functions are described in 152a889d1fbSRobert Watson.Xr acl_set 3 , 153a889d1fbSRobert Watsonand may be used to assign an ACL to a file system object. 154336ee39aSRuslan Ermilov.It Fn acl_set_permset 1556822f9dfSChris D. FaulhaberThis function is described in 1566822f9dfSChris D. Faulhaber.Xr acl_set_permset 3 , 1576822f9dfSChris D. Faulhaberand may be used to set the permissions of an ACL entry from a permset. 158336ee39aSRuslan Ermilov.It Fn acl_set_qualifier 1596822f9dfSChris D. FaulhaberThis function is described in 1606822f9dfSChris D. Faulhaber.Xr acl_set_qualifier 3 , 1616822f9dfSChris D. Faulhaberand may be used to set the qualifier of an ACL. 162336ee39aSRuslan Ermilov.It Fn acl_set_tag_type 1636822f9dfSChris D. FaulhaberThis function is described in 1646822f9dfSChris D. Faulhaber.Xr acl_set_tag_type 3 , 1656822f9dfSChris D. Faulhaberand may be used to set the tag type of an ACL. 166336ee39aSRuslan Ermilov.It Fn acl_to_text 167a889d1fbSRobert WatsonThis function is described in 168a889d1fbSRobert Watson.Xr acl_to_text 3 , 169a889d1fbSRobert Watsonand may be used to generate a text-form of a POSIX.1e semantics ACL. 170336ee39aSRuslan Ermilov.It Xo 171a889d1fbSRobert Watson.Fn acl_valid , 1726394f703SRobert Watson.Fn acl_valid_fd_np , 173a889d1fbSRobert Watson.Fn acl_valid_file_np , 1746394f703SRobert Watson.Fn acl_valid_link_np 175336ee39aSRuslan Ermilov.Xc 176336ee39aSRuslan ErmilovThese functions are described in 177a889d1fbSRobert Watson.Xr acl_valid 3 , 178a889d1fbSRobert Watsonand may be used to validate an ACL as correct POSIX.1e-semantics, or 179a889d1fbSRobert Watsonas appropriate for a particular file system object regardless of semantics. 180336ee39aSRuslan Ermilov.El 18142635956SRuslan Ermilov.Pp 182a889d1fbSRobert WatsonDocumentation of the internal kernel interfaces backing these calls may 183a889d1fbSRobert Watsonbe found in 184a889d1fbSRobert Watson.Xr acl 9 . 185a889d1fbSRobert WatsonThe syscalls between the internal interfaces and the public library 186a21c3aa0SRobert Watsonroutines may change over time, and as such are not documented. 187a21c3aa0SRobert WatsonThey are not intended to be called directly without going through the 188a21c3aa0SRobert Watsonlibrary. 1896822f9dfSChris D. Faulhaber.Sh SEE ALSO 190963b8cdcSRobert Watson.Xr getfacl 1 , 191963b8cdcSRobert Watson.Xr setfacl 1 , 1926822f9dfSChris D. Faulhaber.Xr acl_add_perm 3 , 1936822f9dfSChris D. Faulhaber.Xr acl_calc_mask 3 , 1946822f9dfSChris D. Faulhaber.Xr acl_clear_perms 3 , 1956822f9dfSChris D. Faulhaber.Xr acl_copy_entry 3 , 1966822f9dfSChris D. Faulhaber.Xr acl_create_entry 3 , 1976822f9dfSChris D. Faulhaber.Xr acl_delete_entry 3 , 1986822f9dfSChris D. Faulhaber.Xr acl_delete_perm 3 , 1996822f9dfSChris D. Faulhaber.Xr acl_dup 3 , 2006822f9dfSChris D. Faulhaber.Xr acl_free 3 , 2016822f9dfSChris D. Faulhaber.Xr acl_from_text 3 , 2026822f9dfSChris D. Faulhaber.Xr acl_get 3 , 2036822f9dfSChris D. Faulhaber.Xr acl_get_permset 3 , 2046822f9dfSChris D. Faulhaber.Xr acl_get_qualifier 3 , 2056822f9dfSChris D. Faulhaber.Xr acl_get_tag_type 3 , 2066822f9dfSChris D. Faulhaber.Xr acl_init 3 , 2076822f9dfSChris D. Faulhaber.Xr acl_set 3 , 2086822f9dfSChris D. Faulhaber.Xr acl_set_permset 3 , 2096822f9dfSChris D. Faulhaber.Xr acl_set_qualifier 3 , 2106822f9dfSChris D. Faulhaber.Xr acl_set_tag_type 3 , 2116822f9dfSChris D. Faulhaber.Xr acl_to_text 3 , 2126822f9dfSChris D. Faulhaber.Xr acl_valid 3 , 2135521ff5aSRuslan Ermilov.Xr posix1e 3 , 2145521ff5aSRuslan Ermilov.Xr acl 9 2156822f9dfSChris D. Faulhaber.Sh STANDARDS 216a889d1fbSRobert WatsonPOSIX.1e assigns security labels to all objects, extending the security 217a21c3aa0SRobert Watsonfunctionality described in POSIX.1. 218a21c3aa0SRobert WatsonThese additional labels provide fine-grained discretionary access control, 219a21c3aa0SRobert Watsonfine-grained capabilities, and labels necessary for mandatory access 220a21c3aa0SRobert Watsoncontrol. 221a21c3aa0SRobert WatsonPOSIX.2c describes a set of userland utilities for manipulating these 222a21c3aa0SRobert Watsonlabels. 2236822f9dfSChris D. Faulhaber.Pp 224a21c3aa0SRobert WatsonPOSIX.1e is described in IEEE POSIX.1e draft 17. 225a21c3aa0SRobert WatsonDiscussion of the draft continues on the cross-platform POSIX.1e 226a21c3aa0SRobert Watsonimplementation mailing list. 227a21c3aa0SRobert WatsonTo join this list, see the 228c32381adSMike Pritchard.Fx 229a21c3aa0SRobert WatsonPOSIX.1e implementation page for more information. 230a889d1fbSRobert Watson.Sh HISTORY 231c32381adSMike PritchardPOSIX.1e support was introduced in 232a21c3aa0SRobert Watson.Fx 4.0 ; 233a21c3aa0SRobert Watson.Fx 5.0 234a21c3aa0SRobert Watsonwas the first version to include a complete ACL implementation based 235963b8cdcSRobert Watsonon extended attributes for the UFS and UFS2 file systems. 236963b8cdcSRobert Watson.Pp 237963b8cdcSRobert Watson.Xr getfacl 1 238963b8cdcSRobert Watsonand 239963b8cdcSRobert Watson.Xr setfacl 1 240963b8cdcSRobert Watsondescribe the user tools that permit direct manipulation of complete file 241963b8cdcSRobert WatsonACLs. 242a889d1fbSRobert Watson.Sh AUTHORS 243c32381adSMike Pritchard.An Robert N M Watson 244