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.
-
Set ACLs using
setfacl
: With ACLs enabled, use thesetfacl
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
-
-
Removing ACL permissions: If you want to remove specific permissions:
setfacl -x u:username /path/to/file
-
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