Skip to content
Snippets Groups Projects
Commit d238830b authored by Ondrej Dvorak's avatar Ondrej Dvorak
Browse files

Update standard-file-acl.md

parent 697108e5
No related branches found
No related tags found
2 merge requests!323extended-acls-storage-section,!320Update standard-file-acl.md
# Standard File ACL # Standard File ACL
## Example https://wiki.archlinux.org/title/Access_Control_Lists
Standart ACL
============
Access control list (ACL) provides an additional, more flexible permission mechanism for file systems. It is designed to assist with UNIX file permissions. ACL allows you to give permissions for any user or group to any disk resource.
Show ACL
========
To show permissions, use:
# getfacl <file/dir>
Examples
Set all permissions for user johnny to file named abc:
# setfacl -m "u:johnny:rwx" abc
Check permissions:
# getfacl abc
# file: abc
# owner: someone
# group: someone
user::rw-
user:johnny:rwx
group::r--
mask::rwx
other::r--
Change permissions for user johnny:
# setfacl -m "u:johnny:r-x" abc
Check permissions:
# getfacl abc
# file: abc
# owner: someone
# group: someone
user::rw-
user:johnny:r-x
group::r--
mask::r-x
other::r--
Remove all ACL entries:
# setfacl -b abc
Check permissions:
# getfacl abc
# file: abc
# owner: someone
# group: someone
user::rw-
group::r--
other::r--
Output of ls command
You will notice that there is an ACL for a given file because it will exhibit a + (plus sign) after its Unix permissions in the output of ls -l.
$ ls -l /dev/audio
crw-rw----+ 1 root audio 14, 4 nov. 9 12:49 /dev/audio
$ getfacl /dev/audio
getfacl: Removing leading '/' from absolute path names
# file: dev/audio
# owner: root
# group: audio
user::rw-
user:solstice:rw-
group::rw-
mask::rw-
other::---
The ACL can be modified using the setfacl command.
===================================================
You can list file/directory permission changes without modifying the permissions (i.e. dry-run) by appending the --test flag.
To apply operations to all files and directories recursively, append the -R/--recursive argument.
To set permissions for a user (user is either the user name or ID):
# setfacl -m "u:user:permissions" <file/dir>
To set permissions for a group (group is either the group name or ID):
# setfacl -m "g:group:permissions" <file/dir>
To set permissions for others:
# setfacl -m "other:permissions" <file/dir>
To allow all newly created files or directories to inherit entries from the parent directory (this will not affect files which will be copied into the directory):
# setfacl -dm "entry" <dir>
To remove a specific entry:
# setfacl -x "entry" <file/dir>
To remove the default entries:
# setfacl -k <file/dir>
To remove all entries (entries of the owner, group and others are retained):
# setfacl -b <file/dir>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment