How to set ACL in linux | Redhat Fedora Linux File | Partition Access control configuration

How to set ACL Permission in Redhat Linux

Step 1

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 /home

LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2 
LABEL=/home             /home                   ext3    rw,acl          1 2
LABEL=/tmp              /tmp                    ext3    defaults        1 2
LABEL=/usr              /usr                    ext3    defaults        1 2
LABEL=/var              /var                    ext3    defaults        1 2
/dev/hda8               swap                    swap    defaults        0 0
/dev/hdd1               /Data                   ext3    ro,noatime      1 2
LABEL=/XFS              /XFS                    xfs     rw,noatime      0 2

Reboot the system. If the partition is not in use, you can unmount and remount the partition

#sudo umount /home
#sudo mount /home

Step 2

Create user and group

#useradd user1
#groupadd group1
#usermod -a -G group1 user1

Step 3

Default ACL

Now you can enable ACL by using setfacl command

#mkdir /home/folder1
#chgrp group1 /home/folder1
#chmod g+w /home/folder1
#setfacl --set u::rwx,g::r-x,o::- /home/folder1


To set ACL 
#setfacl -d --set u::rwx,u:user1:rwx,g::rx,g:group1:rx,o::- /home/folder1


To view the acl
# getfacl /home/folder1/

# file: home/folder1/
# owner: root
# group: group1
user::rwx
group::r-x
other::---
default:user::rwx
default:user:user1:rwx
default:group::r-x
default:group:group1:r-x
default:mask::rwx
default:other::---

 



FOLLOW US :-    
   





5 comments :

  1. Its very good explanation and guide.
    -Bala J

    ReplyDelete
  2. good one

    chethan

    ReplyDelete
  3. Hi,
    acl have one issue that .............
    if am configuring acl for other partition i want to restart the system then only it will activate.it is not possible in live machine
    so how to configure acl to other partition without restart the system?

    ReplyDelete
  4. Thank you for saving our life. HAHAHAHAHAHA!

    ReplyDelete
  5. you can 'mount -o remount /...' the filesystem if you don't want to reboot or umount the filesystem.

    ReplyDelete