How to recursively set permissions for ACL in FreeBSD

freebsdThis is not too difficult however as not as straightforward as it can be done in Linux.

setfacl command in Linux has -R directive to set permissions recursively in the same way as with chmod command.

In FreeBSD setfacl does not have -R directive. Use the following examples to recursively set ACL permissions in FreeBSD:Code:

It recursively set modify permissions for user “Itgalaxyz” on the folder /mnt/FreeNAS/test/ and all sub folders, this also specifies file and folder inheritance for these permissions (this will only affect files/folders moved into or created in these folders from this point forward)

Code:

Does the same as above but recursively for files in /mnt/FreeNAS/test/ (obviously no inheritance settings are required)

Change u: to g: for groups, -m to -x to remove ACL entries instead of create/modify.

You can set individual permissions using the letter codes (see below), however these commonly required ones are also available:

  • full_set all permissions
  • modify_set all permissions except write_acl and write_owner
  • read_set read_data, read_attributes, read_xattr and read_acl
  • write_set write_data, append_data, write_attributes and write_xattr
Code:

Want me to do this for you? Drop me a line: itgalaxyzzz {at} gmail [dot] com