How to configure ACL in Linux

Spread the love
ACLs can be configured:

 1.Per user
2. Per group
3.Via the effective rights mask
4.For users not in the user group for the file

Enable ACL support on the partition.
Edit /etc/fstab file and change the default parameter to rw,acl
If we want to enable acl for /mnt

Now, you will need to remount the /mnt partition with the “acl” option. The easiest way to do this is with the “remount” option, since it will work even while the partition is in use:

[root@vishal /]# mount -v -o remount /mnt/
/dev/sda5 on /mnt type ext3 (rw,acl)

Create a user and group:-
 [root@vishal /]# useradd vishal
[root@vishal /]# groupadd linux
[root@vishal /]# usermod -a -G linux vishal

Now, we can actually start using ACLs. The basic commands that we are interested in are:

[root@vishal /]#  setfacl -m u:vishal:rw- /mnt/
[root@vishal /]#  getfacl /mnt/
getfacl: Removing leading ‘/’ from absolute path names
# file: mnt
# owner: root
# group: root

To remove all the permissions for a user, group, or others, use the -x option and do not specify any permissions:
[root@vishal /]# setfacl -x rules files

Vishal Vyas

See also  How to fix apt get update 404 Not Found

Leave a Comment