Tuesday, May 26, 2009

How to implement ACL

ACL 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

e.g. / we want to implement ACL in this partition.

1st of all open fstab file "Be careful this is file system table file"
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
# 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.
# setfacl -m u:baber:rwx /data/file
this command will gives rwx permissions to user baber on specified file.
"/data/file"

# 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

Babar Zahoor
RHCE 5.0

No comments:

Post a Comment