xref: /netbsd-src/share/man/man9/acl.9 (revision 55cf6c3f8013e42d773978bd0c91ee1d7ebbae14)
1*55cf6c3fSchristos.\" $NetBSD: acl.9,v 1.4 2022/01/18 20:38:28 christos Exp $
2e830eb67Swiz.\"-
3e830eb67Swiz.\" Copyright (c) 1999-2001 Robert N. M. Watson
4e830eb67Swiz.\" All rights reserved.
5e830eb67Swiz.\"
6e830eb67Swiz.\" Redistribution and use in source and binary forms, with or without
7e830eb67Swiz.\" modification, are permitted provided that the following conditions
8e830eb67Swiz.\" are met:
9e830eb67Swiz.\" 1. Redistributions of source code must retain the above copyright
10e830eb67Swiz.\"    notice, this list of conditions and the following disclaimer.
11e830eb67Swiz.\" 2. Redistributions in binary form must reproduce the above copyright
12e830eb67Swiz.\"    notice, this list of conditions and the following disclaimer in the
13e830eb67Swiz.\"    documentation and/or other materials provided with the distribution.
14e830eb67Swiz.\"
15e830eb67Swiz.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16e830eb67Swiz.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17e830eb67Swiz.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18e830eb67Swiz.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19e830eb67Swiz.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20e830eb67Swiz.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21e830eb67Swiz.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22e830eb67Swiz.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23e830eb67Swiz.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24e830eb67Swiz.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25e830eb67Swiz.\" SUCH DAMAGE.
26e830eb67Swiz.\"
27e830eb67Swiz.\" $FreeBSD: head/share/man/man9/acl.9 287445 2015-09-04 00:14:20Z delphij $
28e830eb67Swiz.\"
29*55cf6c3fSchristos.Dd January 18, 2022
30e830eb67Swiz.Dt ACL 9
31e830eb67Swiz.Os
32e830eb67Swiz.Sh NAME
33e830eb67Swiz.Nm acl
34e830eb67Swiz.Nd virtual file system access control lists
35e830eb67Swiz.Sh SYNOPSIS
36e830eb67Swiz.In sys/param.h
37e830eb67Swiz.In sys/vnode.h
38e830eb67Swiz.In sys/acl.h
39e830eb67Swiz.Pp
40e830eb67SwizIn the kernel configuration file:
41e830eb67Swiz.Cd "options UFS_ACL"
42e830eb67Swiz.Sh DESCRIPTION
43e830eb67SwizAccess control lists, or ACLs,
44e830eb67Swizallow fine-grained specification of rights
45e830eb67Swizfor vnodes representing files and directories.
46e830eb67SwizHowever, as there are a plethora of file systems with differing ACL semantics,
47e830eb67Swizthe vnode interface is aware only of the syntax of ACLs,
48e830eb67Swizrelying on the underlying file system to implement the details.
49e830eb67SwizDepending on the underlying file system, each file or directory
50e830eb67Swizmay have zero or more ACLs associated with it, named using the
51e830eb67Swiz.Fa type
52e830eb67Swizfield of the appropriate vnode ACL calls:
53e830eb67Swiz.Xr VOP_ACLCHECK 9 ,
54e830eb67Swiz.Xr VOP_GETACL 9 ,
55e830eb67Swizand
56e830eb67Swiz.Xr VOP_SETACL 9 .
57e830eb67Swiz.Pp
58e830eb67SwizCurrently, each ACL is represented in-kernel by a fixed-size
59e830eb67Swiz.Vt acl
60e830eb67Swizstructure, defined as follows:
61e830eb67Swiz.Bd -literal -offset indent
62e830eb67Swizstruct acl {
63e830eb67Swiz        unsigned int            acl_maxcnt;
64e830eb67Swiz        unsigned int            acl_cnt;
65e830eb67Swiz        int                     acl_spare[4];
66e830eb67Swiz        struct acl_entry        acl_entry[ACL_MAX_ENTRIES];
67e830eb67Swiz};
68e830eb67Swiz.Ed
69e830eb67Swiz.Pp
70e830eb67SwizAn ACL is constructed from a fixed size array of ACL entries,
71e830eb67Swizeach of which consists of a set of permissions, principal namespace,
72e830eb67Swizand principal identifier.
73e830eb67SwizIn this implementation, the
74e830eb67Swiz.Vt acl_maxcnt
75e830eb67Swizfield is always set to
76e830eb67Swiz.Dv ACL_MAX_ENTRIES .
77e830eb67Swiz.Pp
78e830eb67SwizEach individual ACL entry is of the type
79e830eb67Swiz.Vt acl_entry_t ,
80e830eb67Swizwhich is a structure with the following members:
81e830eb67Swiz.Bl -tag -width 2n
82e830eb67Swiz.It Vt acl_tag_t Va ae_tag
83e830eb67SwizThe following is a list of definitions of ACL types
84e830eb67Swizto be set in
85e830eb67Swiz.Va ae_tag :
86e830eb67Swiz.Pp
87e830eb67Swiz.Bl -tag -width ".Dv ACL_UNDEFINED_FIELD" -offset indent -compact
88e830eb67Swiz.It Dv ACL_UNDEFINED_FIELD
89e830eb67SwizUndefined ACL type.
90e830eb67Swiz.It Dv ACL_USER_OBJ
91e830eb67SwizDiscretionary access rights for processes whose effective user ID
92e830eb67Swizmatches the user ID of the file's owner.
93e830eb67Swiz.It Dv ACL_USER
94e830eb67SwizDiscretionary access rights for processes whose effective user ID
95e830eb67Swizmatches the ACL entry qualifier.
96e830eb67Swiz.It Dv ACL_GROUP_OBJ
97e830eb67SwizDiscretionary access rights for processes whose effective group ID
98e830eb67Swizor any supplemental groups
99e830eb67Swizmatch the group ID of the file's owner.
100e830eb67Swiz.It Dv ACL_GROUP
101e830eb67SwizDiscretionary access rights for processes whose effective group ID
102e830eb67Swizor any supplemental groups
103e830eb67Swizmatch the ACL entry qualifier.
104e830eb67Swiz.It Dv ACL_MASK
105e830eb67SwizThe maximum discretionary access rights that can be granted
106e830eb67Swizto a process in the file group class.
107e830eb67SwizThis is only valid for POSIX.1e ACLs.
108e830eb67Swiz.It Dv ACL_OTHER
109e830eb67SwizDiscretionary access rights for processes not covered by any other ACL
110e830eb67Swizentry.
111e830eb67SwizThis is only valid for POSIX.1e ACLs.
112e830eb67Swiz.It Dv ACL_OTHER_OBJ
113e830eb67SwizSame as
114e830eb67Swiz.Dv ACL_OTHER .
115e830eb67Swiz.It Dv ACL_EVERYONE
116e830eb67SwizDiscretionary access rights for all users.
117e830eb67SwizThis is only valid for NFSv4 ACLs.
118e830eb67Swiz.El
119e830eb67Swiz.Pp
120e830eb67SwizEach POSIX.1e ACL must contain exactly one
121e830eb67Swiz.Dv ACL_USER_OBJ ,
122e830eb67Swizone
123e830eb67Swiz.Dv ACL_GROUP_OBJ ,
124e830eb67Swizand one
125e830eb67Swiz.Dv ACL_OTHER .
126e830eb67SwizIf any of
127e830eb67Swiz.Dv ACL_USER ,
128e830eb67Swiz.Dv ACL_GROUP ,
129e830eb67Swizor
130e830eb67Swiz.Dv ACL_OTHER
131e830eb67Swizare present, then exactly one
132e830eb67Swiz.Dv ACL_MASK
133e830eb67Swizentry should be present.
134e830eb67Swiz.It Vt uid_t Va ae_id
135e830eb67SwizThe ID of user for whom this ACL describes access permissions.
136e830eb67SwizFor entries other than
137e830eb67Swiz.Dv ACL_USER
138e830eb67Swizand
139e830eb67Swiz.Dv ACL_GROUP ,
140e830eb67Swizthis field should be set to
141e830eb67Swiz.Dv ACL_UNDEFINED_ID .
142e830eb67Swiz.It Vt acl_perm_t Va ae_perm
143e830eb67SwizThis field defines what kind of access the process matching this ACL has
144e830eb67Swizfor accessing the associated file.
145e830eb67SwizFor POSIX.1e ACLs, the following are valid:
146e830eb67Swiz.Bl -tag -width ".Dv ACL_WRITE_NAMED_ATTRS"
147e830eb67Swiz.It Dv ACL_EXECUTE
148e830eb67SwizThe process may execute the associated file.
149e830eb67Swiz.It Dv ACL_WRITE
150e830eb67SwizThe process may write to the associated file.
151e830eb67Swiz.It Dv ACL_READ
152e830eb67SwizThe process may read from the associated file.
153e830eb67Swiz.It Dv ACL_PERM_NONE
154e830eb67SwizThe process has no read, write or execute permissions
155e830eb67Swizto the associated file.
156e830eb67Swiz.El
157e830eb67Swiz.Pp
158e830eb67SwizFor NFSv4 ACLs, the following are valid:
159e830eb67Swiz.Bl -tag -width ".Dv ACL_WRITE_NAMED_ATTRS"
160e830eb67Swiz.It Dv ACL_READ_DATA
161e830eb67SwizThe process may read from the associated file.
162e830eb67Swiz.It Dv ACL_LIST_DIRECTORY
163e830eb67SwizSame as
164e830eb67Swiz.Dv ACL_READ_DATA .
165e830eb67Swiz.It Dv ACL_WRITE_DATA
166e830eb67SwizThe process may write to the associated file.
167e830eb67Swiz.It Dv ACL_ADD_FILE
168e830eb67SwizSame as
169e830eb67Swiz.Dv ACL_ACL_WRITE_DATA .
170e830eb67Swiz.It Dv ACL_APPEND_DATA
171e830eb67Swiz.It Dv ACL_ADD_SUBDIRECTORY
172e830eb67SwizSame as
173e830eb67Swiz.Dv ACL_APPEND_DATA .
174e830eb67Swiz.It Dv ACL_READ_NAMED_ATTRS
175e830eb67SwizIgnored.
176e830eb67Swiz.It Dv ACL_WRITE_NAMED_ATTRS
177e830eb67SwizIgnored.
178e830eb67Swiz.It Dv ACL_EXECUTE
179e830eb67SwizThe process may execute the associated file.
180e830eb67Swiz.It Dv ACL_DELETE_CHILD
181e830eb67Swiz.It Dv ACL_READ_ATTRIBUTES
182e830eb67Swiz.It Dv ACL_WRITE_ATTRIBUTES
183e830eb67Swiz.It Dv ACL_DELETE
184e830eb67Swiz.It Dv ACL_READ_ACL
185e830eb67Swiz.It Dv ACL_WRITE_ACL
186e830eb67Swiz.It Dv ACL_WRITE_OWNER
187e830eb67Swiz.It Dv ACL_SYNCHRONIZE
188e830eb67SwizIgnored.
189e830eb67Swiz.El
190e830eb67Swiz.It Vt acl_entry_type_t Va ae_entry_type
191e830eb67SwizThis field defines the type of NFSv4 ACL entry.
192e830eb67SwizIt is not used with POSIX.1e ACLs.
193e830eb67SwizThe following values are valid:
194e830eb67Swiz.Bl -tag -width ".Dv ACL_WRITE_NAMED_ATTRS"
195e830eb67Swiz.It Dv ACL_ENTRY_TYPE_ALLOW
196e830eb67Swiz.It Dv ACL_ENTRY_TYPE_DENY
197e830eb67Swiz.El
198e830eb67Swiz.It Vt acl_flag_t Va ae_flags
199e830eb67SwizThis field defines the inheritance flags of NFSv4 ACL entry.
200e830eb67SwizIt is not used with POSIX.1e ACLs.
201e830eb67SwizThe following values are valid:
202e830eb67Swiz.Bl -tag -width ".Dv ACL_ENTRY_DIRECTORY_INHERIT"
203e830eb67Swiz.It Dv ACL_ENTRY_FILE_INHERIT
204e830eb67Swiz.It Dv ACL_ENTRY_DIRECTORY_INHERIT
205e830eb67Swiz.It Dv ACL_ENTRY_NO_PROPAGATE_INHERIT
206e830eb67Swiz.It Dv ACL_ENTRY_INHERIT_ONLY
207e830eb67Swiz.It Dv ACL_ENTRY_INHERITED
208e830eb67Swiz.El
209e830eb67SwizThe
210e830eb67Swiz.Dv ACL_ENTRY_INHERITED
211e830eb67Swizflag is set on an ACE that has been inherited from its parent.
212e830eb67SwizIt may also be set programmatically, and is valid on both files
213e830eb67Swizand directories.
214e830eb67Swiz.El
215e830eb67Swiz.Sh SEE ALSO
216e830eb67Swiz.Xr acl 3 ,
217*55cf6c3fSchristos.Xr genfs 9 ,
218*55cf6c3fSchristos.Xr genfs_can_access 9 ,
219*55cf6c3fSchristos.Xr genfs_can_access_acl_nfs4 9 ,
220*55cf6c3fSchristos.Xr genfs_can_access_acl_posix1e 9 ,
221*55cf6c3fSchristos.Xr VOP_ACLCHECK 9 ,
222*55cf6c3fSchristos.Xr VOP_GETACL 9 ,
223*55cf6c3fSchristos.Xr VOP_SETACL 9
224e830eb67Swiz.Sh AUTHORS
225e830eb67SwizThis manual page was written by
226e830eb67Swiz.An Robert Watson .
227