2001-03-19 18:09:25 +00:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 2001 Chris D. Faulhaber
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE
|
|
|
|
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
|
|
|
.Dd January 7, 2001
|
|
|
|
.Dt SETFACL 1
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm setfacl
|
2001-04-18 15:54:10 +00:00
|
|
|
.Nd set ACL information
|
2001-03-19 18:09:25 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-03-23 08:14:27 +00:00
|
|
|
.Nm
|
2001-03-19 18:09:25 +00:00
|
|
|
.Op Fl bdkn
|
|
|
|
.Op Fl m Ar entries
|
|
|
|
.Op Fl M Ar file1
|
|
|
|
.Op Fl x Ar entries
|
|
|
|
.Op Fl X Ar file1
|
2001-03-23 08:14:27 +00:00
|
|
|
.Op Ar
|
2001-03-19 18:09:25 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility sets discretionary access control information on
|
|
|
|
the specified file(s).
|
|
|
|
.Pp
|
|
|
|
The following options are available:
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.It Fl b
|
|
|
|
Remove all ACL entries except for the three required entries.
|
|
|
|
.It Fl d
|
|
|
|
The operations apply to the default ACL entries instead of
|
|
|
|
access ACL entries. Currently only directories may have
|
|
|
|
default ACL's.
|
|
|
|
.It Fl k
|
|
|
|
Delete any default ACL entries on the specified files. It
|
|
|
|
is not considered an error if the specified files do not have
|
|
|
|
any default ACL entries. An error will be reported if any of
|
2001-03-23 08:14:27 +00:00
|
|
|
the specified files cannot have a default entry (i.e.\&
|
2001-03-19 18:09:25 +00:00
|
|
|
non-directories).
|
|
|
|
.It Fl m Ar entries
|
|
|
|
Modify the ACL entries on the specified files by adding new
|
|
|
|
entries and modifying existing ACL entries with the ACL entries
|
|
|
|
specified in
|
|
|
|
.Ar entries .
|
|
|
|
.It Fl M Ar file
|
|
|
|
Modify the ACL entries on the specified files by adding new
|
|
|
|
ACL entries and modifying existing ACL entries with the ACL
|
|
|
|
entries specified in the file
|
|
|
|
.Ar file .
|
|
|
|
If
|
|
|
|
.Ar file
|
2001-03-23 08:14:27 +00:00
|
|
|
is
|
|
|
|
.Fl ,
|
|
|
|
the input is taken from stdin.
|
2001-03-19 18:09:25 +00:00
|
|
|
.It Fl n
|
|
|
|
Do not recalculate the permissions associated with the ACL
|
|
|
|
mask entry.
|
|
|
|
.It Fl x Ar entries
|
|
|
|
Remove the ACL entries specified in
|
|
|
|
.Ar entries
|
|
|
|
from the access or default ACL of the specified files.
|
|
|
|
.It Fl X Ar file
|
|
|
|
Remove the ACL entries specified in the file
|
|
|
|
.Ar file
|
|
|
|
from the access or default ACL of the specified files.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The above options are evaluated in the order specified
|
|
|
|
on the command-line.
|
|
|
|
.Pp
|
2001-03-23 08:14:27 +00:00
|
|
|
Multiple ACL entries specified on the command line are
|
2001-03-19 18:09:25 +00:00
|
|
|
separated by commas.
|
|
|
|
.Sh ACL ENTRIES
|
2001-03-23 08:14:27 +00:00
|
|
|
An ACL entry contains three colon-separated fields:
|
2001-03-19 18:09:25 +00:00
|
|
|
an ACL tag, an ACL qualifier, and discretionary access
|
|
|
|
permissions:
|
|
|
|
.Bl -tag -width indent
|
2001-03-23 08:14:27 +00:00
|
|
|
.It Ar "ACL tag"
|
|
|
|
The ACL tag specifies the ACL entry type and consists of
|
|
|
|
one of the following:
|
|
|
|
.Dq Li user
|
|
|
|
or
|
|
|
|
.Ql u
|
|
|
|
specifying the access
|
|
|
|
granted to the owner of the file or a specified user;
|
|
|
|
.Dq Li group
|
|
|
|
or
|
|
|
|
.Ql g
|
|
|
|
specifying the access granted to the file owning group
|
|
|
|
or a specified group;
|
|
|
|
.Dq Li other
|
|
|
|
or
|
|
|
|
.Ql o
|
|
|
|
specifying the access
|
2001-03-19 18:09:25 +00:00
|
|
|
granted to any process that does not match any user or group
|
2001-03-23 08:14:27 +00:00
|
|
|
ACL entry;
|
|
|
|
.Dq Li mask
|
|
|
|
or
|
|
|
|
.Ql m
|
|
|
|
specifying the maximum access
|
2001-03-19 18:09:25 +00:00
|
|
|
granted to any ACL entry except the
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li user
|
2001-03-19 18:09:25 +00:00
|
|
|
ACL entry for the file owner and the
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li other
|
2001-03-19 18:09:25 +00:00
|
|
|
ACL entry.
|
2001-03-23 08:14:27 +00:00
|
|
|
.It Ar "ACL qualifier"
|
2001-03-19 18:09:25 +00:00
|
|
|
The ACL qualifier field describes the user or group associated with
|
|
|
|
the ACL entry. It may consist of one of the following: uid or
|
|
|
|
user name, gid or group name, or empty. For
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li user
|
|
|
|
ACL entries, an empty field specifies access granted to the
|
2001-03-19 18:09:25 +00:00
|
|
|
file owner. For
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li group
|
|
|
|
ACL entries, an empty field specifies access granted to the
|
2001-03-19 18:09:25 +00:00
|
|
|
file owning group.
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li mask
|
2001-03-19 18:09:25 +00:00
|
|
|
and
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li other
|
2001-03-19 18:09:25 +00:00
|
|
|
ACL entries do not use this field.
|
2001-03-23 08:14:27 +00:00
|
|
|
.It Ar "access permissions"
|
|
|
|
The access permissions field contains up to one of each of
|
|
|
|
the following:
|
|
|
|
.Ql r ,
|
|
|
|
.Ql w ,
|
|
|
|
and
|
|
|
|
.Ql x
|
|
|
|
to set read, write, and
|
2001-03-19 18:09:25 +00:00
|
|
|
execute permissions, respectively. Each of these may be excluded
|
2001-03-23 08:14:27 +00:00
|
|
|
or replaced with a
|
|
|
|
.Ql -
|
|
|
|
character to indicate no access.
|
2001-03-19 18:09:25 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
A
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li mask
|
2001-03-19 18:09:25 +00:00
|
|
|
ACL entry is required on a file with any ACL entries other than
|
|
|
|
the default
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li user ,
|
|
|
|
.Dq Li group ,
|
2001-03-19 18:09:25 +00:00
|
|
|
and
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li other
|
2001-03-19 18:09:25 +00:00
|
|
|
ACL entries. If the
|
|
|
|
.Fl n
|
|
|
|
option is not specified and no
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li mask
|
2001-03-19 18:09:25 +00:00
|
|
|
ACL entry was specified, the
|
|
|
|
.Nm
|
|
|
|
utility
|
|
|
|
will apply a
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li mask
|
2001-03-19 18:09:25 +00:00
|
|
|
ACL entry consisting of the union of the permissions associated
|
|
|
|
with all
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li group
|
2001-03-19 18:09:25 +00:00
|
|
|
ACL entries in the resulting ACL.
|
|
|
|
.Pp
|
|
|
|
ACL entries applied from a file using the
|
|
|
|
.Fl M
|
|
|
|
or
|
|
|
|
.Fl X
|
|
|
|
options shall be of the following form: one ACL entry per line, as
|
2001-03-23 08:14:27 +00:00
|
|
|
previously specified; whitespace is ignored; any text after a
|
|
|
|
.Ql #
|
|
|
|
is ignored (comments).
|
2001-03-19 18:09:25 +00:00
|
|
|
.Pp
|
|
|
|
When ACL entries are evaluated, the access check algorithm checks
|
|
|
|
the ACL entries in the following order: file owner,
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li user
|
2001-03-19 18:09:25 +00:00
|
|
|
ACL entries, file owning group,
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li group
|
2001-03-19 18:09:25 +00:00
|
|
|
ACL entries, and
|
2001-03-23 08:14:27 +00:00
|
|
|
.Dq Li other
|
2001-03-19 18:09:25 +00:00
|
|
|
ACL entry.
|
2001-03-23 08:14:27 +00:00
|
|
|
.Sh DIAGNOSTICS
|
2001-08-15 09:09:47 +00:00
|
|
|
.Ex -std
|
2001-03-19 18:09:25 +00:00
|
|
|
.Sh EXAMPLES
|
|
|
|
.Dl setfacl -m u::rwx,g:mail:rw file
|
|
|
|
.Pp
|
|
|
|
Sets read, write, and execute permissions for the
|
|
|
|
.Pa file
|
|
|
|
owner's ACL entry and read and write permissions for group mail on
|
|
|
|
.Pa file .
|
|
|
|
.Pp
|
|
|
|
.Dl setfacl -M file1 file2
|
|
|
|
.Pp
|
|
|
|
Sets/updates the ACL entries contained in
|
|
|
|
.Pa file1
|
|
|
|
on
|
|
|
|
.Pa file2 .
|
|
|
|
.Pp
|
|
|
|
.Dl setfacl -x g:mail:rw file
|
|
|
|
.Pp
|
|
|
|
Remove the group mail ACL entry containing read/write permissions
|
|
|
|
from
|
|
|
|
.Pa file.
|
|
|
|
.Pp
|
|
|
|
.Dl setfacl -b file
|
|
|
|
.Pp
|
|
|
|
Remove all ACL entries except for the three required
|
|
|
|
entries from
|
|
|
|
.Pa file .
|
|
|
|
.Pp
|
|
|
|
.Dl getfacl file1 | setfacl -b -n -M - file2
|
|
|
|
.Pp
|
|
|
|
Copy ACL entries from
|
|
|
|
.Pa file1
|
|
|
|
to
|
|
|
|
.Pa file2 .
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr getfacl 1 ,
|
|
|
|
.Xr acl 3 ,
|
|
|
|
.Xr getextattr 8 ,
|
|
|
|
.Xr setextattr 8 ,
|
|
|
|
.Xr acl 9 ,
|
2001-03-23 08:14:27 +00:00
|
|
|
.Xr extattr 9
|
2001-03-19 18:09:25 +00:00
|
|
|
.Sh STANDARDS
|
|
|
|
The
|
|
|
|
.Nm
|
2001-03-23 08:14:27 +00:00
|
|
|
utility is expected to be
|
|
|
|
.Tn IEEE
|
|
|
|
Std 1003.2c compliant.
|
2001-03-19 18:09:25 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
Extended Attribute and Access Control List support was developed
|
2001-03-23 08:14:27 +00:00
|
|
|
as part of the
|
|
|
|
.Tn TrustedBSD
|
|
|
|
Project and introduced in
|
2001-03-19 18:09:25 +00:00
|
|
|
.Fx 5.0 .
|
|
|
|
.Sh AUTHORS
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility was written by
|
|
|
|
.An Chris D. Faulhaber Aq jedgar@fxp.org .
|