How to implement ACL (Access control list) in CentOS / RHEL /Fedora by Babar Zahoor

Learn | Teach Open Source Technologies

How to implement ACL (Access control list) in CentOS / RHEL /Fedora by Babar Zahoor

ACL  is Access Control List

Linux operating system supports ACL option &  if we want to implement ACL option we have to specify in witch partition we
want to implement ACL  i.e. We want to implement ACL in this partition.

First of all open fstab file “Be careful this is file system table file”
root@localhost# vim /etc/fstab

LABEL=/ / ext3 defaults 1 1
LABEL=/usr /usr ext3 defaults 1 2
LABEL=/var /var ext3 defaults 1 2
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-hda6 swap swap defaults 0 0

add acl option in the line where / partition information is written.
add acl option after defaults option.
e.g. defaults,acl

then save file and exit.

run command on shell
root@localhost# mount -o remount /

getfacl command is used to implement ACL

-m for adding and editing ACL
-x for removing.
u for user or userid
g for group or groupid
e.g.
root@localhost# setfacl -m u:baber:rwx /data/file

this command will gives rwx permissions to user baber on specified file. “/data/file”
root@localhost# setfacl -m g:baber:rwx /data/file
this command will gives rwx permissions to group baber on specified file.
“/data/file”

to check ACL
# getfacl /data/file

To remove ACL

setfacl -x u:baber
setfacl -x g:baber