1.Configure ACL (Access Control List) on Linux.
2. Create a new Acl, modify or remove ACL.
ACL (Access Control List)
We know how to add a users to a group but if we do not want to add user in a group and want to allow some permissions to user on directory, how can we do that?? Then need to configure ACL on linux. Two types of ACL are:
- Access ACL – Can be used on any file or directory.
- Default ACL – Used on giving or setting ACL on a specific directory. These are optional and used with ‘-d’ option.
How to Check default ACL
Use command getfacl to check default ACL.
[arun@localhost ~]$ getfacl centos/
setfacl command used for creating ACL. It is indicated by ‘+’ sign .To create a ACL for a user, syntax is:
setfacl -m u: arun:rw centos/
setfacl : set ACL
-m : To modify or create new ACL
u : used for user
arun : username
rw : permission allow
centos/ : file or directory path
[arun@localhost ~]$ setfacl -m u:arun:rw centos/
You can also set ACL for a group:
setfacl -m g:group:rw path of a file
How to remove all the ACL from a file/directory
To remove all the ACL from file/directory, -b argument used.
[arun@localhost ~]$ setfacl -b centos/
Remove specified ACL from a file/directory
Argument ‘-x’ used for this:
[arun@localhost ~]$ setfacl -x u:arun:rw centos/
Congratulations !! you have successfully learned how to create or remove ACL (Access Control List) on Linux.