Wiki LogoWiki - The Power of Many

Nfs4 acl

Contents

  • 1 Abstract
  • 2 package
  • 2.1 ACE Type
  • 2.2 ACE Flags
  • 3 ACE Principal
  • 4 ACE Permissions
  • 5 Using NFSv4 ACL
  • 5.1 nfs4_editfacl
  • 5.2 nfs4_getfacl
  • 5.3 nfs4_setfacl
  • 5.3.1 commands
  • 5.3.2 Options
  • 5.4 Use cases

Abstract

This shows you how to use the NFSv4 ACL permissions system. An ACL (access control list) is a list of permissions associated with a file or directory. These permissions allow you to restrict access to a certian file or directory by user or group. NFSv4 ACLs provide more specific options than typical POSIX read/write/execute permissions used in most systems.

package

You need install package to use nfs4_acl

rpm package name is nfs4-acl-tools

Understanding NFSv4 ACL

This is an example of an NFSv4 ACL

A::user@nfsdomain.org:rxtncy

The following sections will break down this example from left to right and provide more usage options

ACE Type

The 'A' in the example is known as the ACE (access control entry) type. The 'A' denotes "Allow" meaning this ACL is allowing the user or group to perform actions requiring permissions. Anything that is not explicitly allowed is denied by default.

Note: 'D' can denote a Deny ACE. While this is a valid option, this ACE type is not reccomended since any permission that is not explicity granted is automatically denied meaning Deny ACE's can be redundant and complicated.

ACE Flags

The above example could have a distinction known as a flag shown below

A:d:user@nfsdomain.org:rxtncy

The 'd' used above is called an inheritence flag. This makes it so the ACL set on this directory will be automatically established on any new subdirectories. Inheritence flags only work on directories and not files. Multiple inheritence flags can be used in combonation or omitted entirely. Examples of inheritence flags are listed below:

FlagNameFunction
ddirectory-inheritNew subdirectories will have the same ACE
ffile-inheritNew files will have the same ACE minus the inheritence flags
nno-propogate inheritNew subdirectories will inherit the ACE minus the inheritence flags
iinherit-onlyNew files and subdirectories will have this ACE but the ACE for the directory with the flag is null

ACE Principal

the 'user@nfsdomain.org' is a principal. The principal denotes the people the ACL is allowing access to.

Principals can be the following:

  • A named user user1@nfsdomain.org
  • Speical principals OWNER@ GROUP@ EVERYONE@
  • A group A:g
    @nfsdomain.org
    When the principal is a group, you need to add a group flag, 'g', as shown above example.

ACE Permissions

the 'rxtncy' are the permissions the ACE is allowing. Permissions can be used in combonation with each other.

A list of permissions and what they do can be found below:

PermissionFunction
rread-data (files) / list-directory (directories)
wwrite-data (files) / create-file (directories)
aappend-data (files) / create-subdirectory (directories)
xexecute (files) / change-directory (directories)
ddelete the file/directory
Ddelete-child : remove a file or subdirectory from the given directory (directories only)
tread the attributes of the file/directory
Twrite the attribute of the file/directory
nread the named attributes of the file/directory
Nwrite the named attributes of the file/directory
cread the file/directory ACL
Cwrite the file/directory ACL
ochange ownership of the file/directory

Aliases such 'R' 'W' 'X' can be used as permissions. These work simlarly to POSIX Read/Write/Execute. More detail can be found below.

AliasNameExpansion
RReadrntcy
WWritewatTNcCy (with D added to directory ACE's
XExecutextcy

Summary

ACE Type
AA = Allow : it means Allow accesses.
DD = Deny : it means Deny accesses.
ACE Flags
dDirectory-Inherit : New sub-directory inherits the same ACE.
fFile-Inherit : New file inherits the same ACE but not inherit inheritance-flag.
nNo-Propogate-Inherit : New sub-directory inherits the same ACE but not inherit inheritance-flag.
iInherit-Only : New file/sub-directory inherits the same ACE but this directory does not have ACE.
ACE Principal
(USER)@(NFSDomain)Common User For [NFSDomain], it is just the Domain name that is specified for [Domain] value in [idmapd.conf].
(GROUP)@(NFSDomain)Common Group For group, Specify [g] flag like this ⇒ A:g
@NFSDomain
OWNER@Special Principal : Owner
GROUP@Special Principal : Group
EVERYONE@Special Principal : Everyone
ACE Permissions
rRead data of files / List files in directory
wWrite data to files / Create new files in directory
aAppend data to files / Create new sub-directory
xExecute files / Change directory
dDelete files or directories
DDelete files or sub-directories under the directory
tRead attributes of files or directories
TWrite attributes to files or directories
nRead named attributes of files or directories
NWrite named attributes of files or directories
cRead ACL of files or directories
CWrite ACL of files or directories
oChange ownership of files or directories
ACE Permissions AliasesFor using nfs4_setfacl, possible to use Alias for ACE Permissions
RR = rntcy : Generic Read
WW = watTNcCy : Generic Write
XX = xtcy : Generic Execute

Using NFSv4 ACL

nfs4_editfacl

nfs4_getfacl

nfs4_gefacl /path

nfs4_setfacl

commands

Commands are only used when first setting an ACE. Commands and their uses are listed below.

COMMANDFUNCTION
-a acl_spec [index]add ACL entries in acl_spec at index (DEFAULT: 1)
-x acl_specindex
-A file [index]read ACL entries to add from file
-X fileread ACL entries to remove from file
-s acl_specset ACL to acl_spec (replaces existing ACL)
-S fileread ACL entries to set from file
-m from_ace to_acemodify in-place: replace 'from_ace' with 'to_ace'
Options

Options can be used in combination or ommitted entirely. A list of options is shown below:

OPTIONNAMEFUNCTION
-RrecursiveApplies ACE to a directory's files and subdirectories
-LlogicalUsed with -R, follows symbolic links
-PphysicalUsed with -R, skips symbolic links

Use cases

nfs4_setfacl -Ra A::user1@domain:RWX /path
nfs4_setfacl -a A:fdg:group1@domain:RWX /path

reference:

https://www.server-world.info/en/note?os=Rocky_Linux_8&p=nfs&f=3

On this page