Setting Access Control Lists (ACLs) in Linux
Setting Access Control Lists (ACLs) in Linux:
Within the Linux operating system, ACLs give the administrator control of what files particular users and groups have access to.
Let’s start with a simple .txt file like this:
-rwx------ 1 kevinjlewin kevinjlewin 0 Jun 29 07:43 test.txt
We can see that currently the owner of the file has read, write and execute permissions and group and world have 0 permissions.
Let’s say we wanted to maintain these permissions but just give one other user permission to read the file. We can do this with an ACL.
The command works as follows:
setfacl –m u:angela:r test.txt
This will allow user “angela” to also read test.txt even though she is not the owner of the file. This access list only applies to user angela.
This can also be done on a group level:
setfacl –m g:admin:r test.txt
This ACL will allow users of the group “admin” to read test.txt.
You can view all the active ACLs on a certain file by using:
You can remove all ACLs from a file and use default permissions using:
setfacl –b test.txt