Access controls were easier to manage in the past. With a few commands (e.g chown, chmod) we were manipulating file permissions. There were a few attributes to manage and security wasn’t much of a concern as we have now. As the security threats increase we have to add additional levels of protection. What I am telling you now is how you can change permissions of files in Linux with a different method.
In order to use POSIX access control lists, your kernel must have this feature enabled. In order to understand you have this feature or not, you can have a look at into your kernel config file in the first place for the string “POSIX_ACL”. If you see a similar output in which the attributes are set to “y”, then you have the feature.
| [root@rh54srv1 ~]# grep “POSIX_ACL” /boot/config-`uname -r` CONFIG_EXT2_FS_POSIX_ACL=y CONFIG_EXT3_FS_POSIX_ACL=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_FS_POSIX_ACL=y |
If you are using a redhat based system, you should have it by default. Shortly if you file system has been mounted with the option “acl” then you can use POSIX ACLs. Here is a brief explanation of how you can use ACLs with examples.
1) I have a test folder which belongs to root user only but I want also the user “accountant” to have read,write and execute permissions on this folder by keeping the current permission.
| [root@rh54srv1 /]# ls -l / | grep test drwx—— 2 root root 4096 Dec 31 00:11 test |
2) First run setfacl command as follows;
| #setfacl -R -n -m u:accountant:rwx /test |
and check the permissions;
| [root@rh54srv1 /]# ls -l / | grep test drwx——+ 2 root root 4096 Dec 31 00:11 test |
Have you seen the difference? A plus sign has been added into the flags. Now lets display the new permissions with getfacl tool.
| [root@rh54srv1 /]# getfacl /test getfacl: Removing leading ‘/’ from absolute path names # file: test # owner: root # group: root user::rwx user:accountant:rwx #effective:— group::— mask::— other::— |


