Print this page
12288 getfacl and setfacl could stand improvement

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man5/acl.5
          +++ new/usr/src/man/man5/acl.5
   1    1  '\" te
        2 +.\" Copyright (c) 2020 Peter Tribble.
   2    3  .\" Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
   3    4  .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
   4    5  .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   5    6  .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   6    7  .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   7      -.TH ACL 5 "Nov 24, 2014"
        8 +.TH ACL 5 "Feb 8, 2020"
   8    9  .SH NAME
   9   10  acl \- Access Control Lists
  10   11  .SH DESCRIPTION
  11      -.LP
  12   12  Access control lists (ACLs) are discretionary access control mechanisms that
  13   13  grant and deny access to files and directories. Two different ACL models are
  14      -supported in the Solaris release: POSIX-draft ACLs and NFSv4 ACLs.
       14 +supported in this release: POSIX-draft ACLs and NFSv4 ACLs.
  15   15  .sp
  16   16  .LP
  17   17  The older, POSIX-draft model is supported by the UFS file system. This model is
  18   18  based on a withdrawn ACL POSIX specification that was never standardized. It
  19   19  was subsequently withdrawn by the POSIX committee.
  20   20  .sp
  21   21  .LP
  22   22  The other model is based on the standards of the NFSv4 working group and is an
  23   23  approved standard from the Internet Engineering Task Force (IETF). The ZFS file
  24   24  system uses the NFSv4 model, and provides richer semantics and finer grained
  25   25  permission capabilities than the POSIX-draft model.
  26      -.SS "\fBPOSIX\fR-draft \fBACL\fRs"
  27      -.LP
       26 +.SS "POSIX-draft ACLs"
  28   27  POSIX-draft ACLs provide an alternative security mechanism to basic UNIX file
  29      -permissions in the Solaris release. Their purpose is to further restrict access
       28 +permissions. Their purpose is to further restrict access
  30   29  to files and directories or to extend permissions to a particular user. ACLs
  31   30  can be used to change the permissions for the standard owner, group and other
  32   31  class bits of a file's mode. ACLs can give additional users and groups access
  33   32  to the file. A directory can also have a special kind of ACL called a
  34   33  \fBdefault\fR ACL, which defines ACL entries to be inherited by descendents of
  35   34  the directory. POSIX-draft ACLs have an ACL entry called \fBmask\fR. The mask
  36   35  defines the maximum permissions that can be granted to additional user and
  37   36  group entries. Whenever a file is created or its mode is changed by
  38   37  \fBchmod\fR(1) or \fBchmod\fR(2), the mask is recomputed. It is recomputed to
  39   38  be the group permission defined in the mode passed to \fBchmod\fR(2).
↓ open down ↓ 57 lines elided ↑ open up ↑
  97   96  For example to give user \fBjoe\fR read and write permissions, the ACL entry is
  98   97  specified as:
  99   98  .sp
 100   99  .in +2
 101  100  .nf
 102  101  user:joe:rw-
 103  102  .fi
 104  103  .in -2
 105  104  .sp
 106  105  
 107      -.SS "\fBNFS\fRv4 \fBACL\fRs"
 108      -.LP
 109      -NFSv4 ACL model is based loosely on the Windows NT ACL model. NFSv4 ACLs
      106 +.SS "NFSv4 ACLs"
      107 +The NFSv4 ACL model is based loosely on the Windows NT ACL model. NFSv4 ACLs
 110  108  provide a much richer ACL model than POSIX-draft ACLs.
 111  109  .sp
 112  110  .LP
 113  111  The major differences between NFSv4 and POSIX-draft ACLs are as follows:
 114  112  .RS +4
 115  113  .TP
 116  114  .ie t \(bu
 117  115  .el o
 118  116  NFSv4 ACLs provide finer grained permissions than the \fBrwx\fR model.
 119  117  .RE
↓ open down ↓ 24 lines elided ↑ open up ↑
 144  142  In the case of directories, you can indicate whether inheritance is applied to
 145  143  the directory itself, to just one level of subdirectories, or cascades to all
 146  144  subdirectories of the directory.
 147  145  .RE
 148  146  .RE
 149  147  .RS +4
 150  148  .TP
 151  149  .ie t \(bu
 152  150  .el o
 153  151  NFSv4 ACLs provide a mechanism for hooking into a system's audit trail.
 154      -Currently, Solaris does not support this mechanism.
      152 +Currently, illumos does not support this mechanism.
 155  153  .RE
 156  154  .RS +4
 157  155  .TP
 158  156  .ie t \(bu
 159  157  .el o
 160  158  NFSv4 ACLs enable administrators to specify the order in which ACL entries are
 161  159  checked. With POSIX-draft ACLs the file system reorders ACL entries into a well
 162  160  defined, strict access, checking order.
 163  161  .RE
 164  162  .sp
↓ open down ↓ 368 lines elided ↑ open up ↑
 533  531  follows:
 534  532  .sp
 535  533  .in +2
 536  534  .nf
 537  535  user:fred:rwR:f:allow
 538  536  user:fred:rwR:f------:allow
 539  537  .fi
 540  538  .in -2
 541  539  .sp
 542  540  
 543      -.SS "Shell-level Solaris \fBAPI\fR"
 544      -.LP
 545      -The Solaris command interface supports the manipulation of ACLs. The following
 546      -Solaris utilities accommodate both ACL models:
      541 +.SS "Shell-level API"
      542 +Several utilities support the manipulation of ACLs. The following
      543 +utilities accommodate both ACL models:
 547  544  .sp
 548  545  .ne 2
 549  546  .na
 550  547  \fB\fBchmod\fR\fR
 551  548  .ad
 552  549  .RS 12n
 553  550  The \fBchmod\fR utility has been enhanced to allow for the setting and deleting
 554  551  of ACLs. This is achieved by extending the symbolic-mode argument to support
 555  552  ACL manipulation. See \fBchmod\fR(1) for details.
 556  553  .RE
↓ open down ↓ 92 lines elided ↑ open up ↑
 649  646  .sp
 650  647  .ne 2
 651  648  .na
 652  649  \fB\fBunpack\fR\fR
 653  650  .ad
 654  651  .RS 12n
 655  652  When a file with an ACL is unpacked, the unpacked file retains the ACL
 656  653  information.
 657  654  .RE
 658  655  
 659      -.SS "Application-level \fBAPI\fR"
 660      -.LP
      656 +.SS "Application-level API"
 661  657  The primary interfaces required to access file system ACLs at the programmatic
 662  658  level are the \fBacl_get()\fR and \fBacl_set()\fR functions. These functions
 663      -support both POSIX draft ACLs and NFSv4 ACLs.
 664      -.SS "Retrieving a file's \fBACL\fR"
      659 +support both POSIX-draft ACLs and NFSv4 ACLs.
      660 +.SS "Retrieving a file's ACL"
 665  661  .in +2
 666  662  .nf
 667  663  int acl_get(const char *path, int flag, acl_t **aclp);
 668  664  int facl_get(int fd, int flag, acl_t **aclp);
 669  665  .fi
 670  666  .in -2
 671  667  
 672  668  .sp
 673  669  .LP
 674      -The \fBacl_get\fR(3SEC) and \fBfacl_get\fR(3SEC) functions retrieves an ACL on
      670 +The \fBacl_get\fR(3SEC) and \fBfacl_get\fR(3SEC) functions retrieve an ACL on
 675  671  a file whose name is given by path or referenced by the open file descriptor
 676  672  fd. The flag argument specifies whether a trivial ACL should be retrieved. When
 677      -the flag argument equals \fBACL_NO_TRIVIAL\fR then only ACLs that are not
      673 +the flag argument equals \fBACL_NO_TRIVIAL\fR only ACLs that are not
 678  674  trivial are retrieved. The ACL is returned in the \fBaclp\fR argument.
 679      -.SS "Freeing \fBACL\fR structure"
      675 +.SS "Freeing ACL structure"
 680  676  .in +2
 681  677  .nf
 682      -void acl_free(acl_t *aclp)s;
      678 +void acl_free(acl_t *aclp);
 683  679  .fi
 684  680  .in -2
 685  681  
 686  682  .sp
 687  683  .LP
 688  684  The \fBacl_free()\fR function frees up memory allocated for the argument
 689      -\fBaclp;\fR.
 690      -.SS "Setting an \fBACL\fR on a file"
      685 +\fBaclp\fR.
      686 +.SS "Setting an ACL on a file"
 691  687  .in +2
 692  688  .nf
 693  689  int acl_set(const char *path, acl_t *aclp);
 694  690  int facl_set(int fd, acl_t *aclp);
 695  691  .fi
 696  692  .in -2
 697  693  
 698  694  .sp
 699  695  .LP
 700  696  The \fBacl_set\fR(3SEC) and \fBfacl_get\fR(3SEC) functions are used for setting
 701  697  an ACL on a file whose name is given by path or referenced by the open file
 702  698  descriptor \fBfd\fR. The \fBaclp\fR argument specifies the ACL to set. The
 703      -\fBacl_set\fR(3SEC) translates an POSIX-draft ACL into a NFSv4 ACL when the
 704      -target file systems supports NFSv4 ACLs. No translation is performed when
      699 +\fBacl_set\fR(3SEC) function translates a POSIX-draft ACL into a NFSv4 ACL when
      700 +the target file system supports NFSv4 ACLs. No translation is performed when
 705  701  trying to set an NFSv4 ACL on a POSIX-draft ACL supported file system.
 706      -.SS "Determining an \fBACL\fR's trivialness"
      702 +.SS "Determining an ACL's trivialness"
 707  703  .in +2
 708  704  .nf
 709  705  int acl_trivial(const char *path);
 710  706  .fi
 711  707  .in -2
 712  708  
 713  709  .sp
 714  710  .LP
 715  711  The \fBacl_trivial()\fR function is used to determine whether a file has a
 716  712  trivial ACL.
 717      -.SS "Removing all \fBACL\fRs from a file"
      713 +.SS "Removing all ACLs from a file"
 718  714  .in +2
 719  715  .nf
 720  716  int acl_strip(const char *path, uid_t uid, gid_t gid, mode_t mode);
 721  717  .fi
 722  718  .in -2
 723  719  
 724  720  .sp
 725  721  .LP
 726  722  The \fBacl_strip()\fR function removes all ACLs from a file and replaces them
 727  723  with a trivial ACL based off of the passed in argument mode. After replacing
 728  724  the ACL the owner and group of the file are set to the values specified in the
 729  725  uid and gid parameters.
 730      -.SS "Converting \fBACL\fRs to/from external representation"
      726 +.SS "Converting ACLs to/from external representation"
 731  727  .in +2
 732  728  .nf
 733  729  int acl_fromtext(const char *path, acl_t **aclp);
 734  730  char *acl_totext(acl_t *aclp, int flags);
 735  731  .fi
 736  732  .in -2
 737  733  
 738  734  .sp
 739  735  .LP
 740  736  The \fBacl_totext()\fR function converts an internal ACL representation pointed
 741  737  to by aclp into an external representation. See \fBDESCRIPTION\fR for details
 742  738  about external representation.
 743  739  .sp
 744  740  .LP
 745      -The \fBacl_fromtext()\fR functions converts and external representation into an
      741 +The \fBacl_fromtext()\fR function converts an external representation into an
 746  742  internal representation. See \fBDESCRIPTION\fR for details about external
 747  743  representation.
 748  744  .SH EXAMPLES
 749      -.LP
 750  745  The following examples demonstrate how the API can be used to perform basic
 751  746  operations on ACLs.
 752  747  .LP
 753  748  \fBExample 1 \fRRetrieving and Setting an ACL
 754  749  .sp
 755  750  .LP
 756  751  Use the following to retrieve an ACL and set it on another file:
 757  752  
 758  753  .sp
 759  754  .in +2
↓ open down ↓ 64 lines elided ↑ open up ↑
 824  819  
 825  820  .sp
 826  821  .in +2
 827  822  .nf
 828  823  error = acl_strip("file", 10, 100, 0644);
 829  824  \&...
 830  825  .fi
 831  826  .in -2
 832  827  
 833  828  .SH SEE ALSO
 834      -.LP
 835  829  \fBchgrp\fR(1), \fBchmod\fR(1), \fBchown\fR(1), \fBcp\fR(1), \fBcpio\fR(1),
 836  830  \fBfind\fR(1), \fBls\fR(1), \fBmv\fR(1), \fBtar\fR(1), \fBsetfacl\fR(1),
 837  831  \fBchmod\fR(2), \fBacl\fR(2), \fBstat\fR(2), \fBacl_get\fR(3SEC),
 838  832  \fBaclsort\fR(3SEC), \fBacl_fromtext\fR(3SEC), \fBacl_free\fR(3SEC),
 839  833  \fBacl_strip\fR(3SEC), \fBacl_trivial\fR(3SEC)
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX