Linux, like most operating systems, has a standard set of file permissions. Aside from there, it also has more refined set of permissions implemented through access control lists. Now we will find out how they are used to implement file system security for files, directories, and more.
Setting Up ACLs
Verify the package installation:
You need to make sure that file system has been mounted with the ACL parameter:
If you want the ACL always available, you need to adjust the /etc/fstab file.
The filesystem is now mounted properly with the ACL option, so you can start to look at the management commands that pertain to ACLs:
getfacl Obtains the ACL from a file or directory
setfacl Sets or modifies an ACL
Step 1. Now we create a test file and get the default information of ACL
Step 2. Allow user01 to access this file and take a look at the permission
You can see that user01 has now been added to the list as having read, write, and execute permissions on this file.
Step 3. Suppose you want to remove user01 permission from the test file. Let’s use the setfacl command again:
Step 4. If you want to remove multiple ACLs on a single file, you can use -b option instead of removing them one by one:
# setfacl -b /opt/backup/test
Using ACLs will help you mange files between users more effectively and will save you from a permission headache later.
Have fun!