How to set ACL in linux Directory Partition File

How to set ACL in Redhat Fedora Cent OS Ubuntu Linux File System, Directory and Partitions in Command Line.

Set ACL Linux

Step 1

Enable ACL support on the partition.
Edit /etc/fstab file and change the default parameter to rw,acl
If you 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::—

5 thoughts on “How to set ACL in linux Directory Partition File

  1. Anonymous

    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?

    Reply
  2. Anonymous

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

    Reply

Leave a Reply to Anonymous Cancel reply

Your email address will not be published. Required fields are marked *