Skip to main content

Permissions on Storage

How to check file/folder permissions

Anywhere the folder is mounted, view ACLs using getfacl:

getfacl /path/to/file

or

ls -l /path/to/folder

How to change file/folder permissions

We should be changing permissions with extended attributes. On a ZFS filesystem in Linux, you can use extended attributes to manage access control lists (ACLs) for more granular permissions, going beyond the traditional chmod approach.

  1. Set ACLs using setfacl: With ACLs enabled, use the setfacl command to specify access permissions for different users, groups, or roles:

    • To give read, write, and execute permissions to a user on a file:

      setfacl -m u:username:rwx /path/to/file
      
    • To apply permissions recursively across a directory:

      setfacl -R -m u:username:rwx /path/to/directory
      
  2. Removing ACL permissions: If you want to remove specific permissions:

    setfacl -x u:username /path/to/file
    
  3. Setting default ACLs: For new files created within a directory to inherit permissions, set default ACLs on the directory:

    setfacl -d -m u:username:rwx /path/to/directory