User Tools

Site Tools


Posfix ACLs

What is ACL?

Due to the limitations of permission/ownership setup with the files/folder in Linux (for example we cannot setup different permission for different users to access the same file). To overcome this problem ACL(Access Control Lists) are introduced. We can use the setfacl & getfacl command to setup the acl for folder and files.

Setting up ACL’s using setfacl

In the below example, i have created two separate users called user1 and user2 and i am going to setup full access and partial access to the /root directory for this two users (which is the home directory for root). The first user user1 will have full and the second user2 have only the read and execute permissions.

setfacl -m u:user1:rwx /root
setfacl -m u:user2:rx /root

Copy ACLs

getfacl file1 | setfacl --set-file=- file2

Copy ACLs all items in a directory
LIST="`cd /vol1/public/Data && ls | sed \"s/ /_/g\"`"
for i in $LIST
        ITEM="`echo $i |  sed \"s/_/ /g\"`"
        getfacl /vol1/public/Data/"$ITEM" | setfacl --set-file=- /vol2/public/Data/"$ITEM"
fileservices/posfix_acls.txt · Last modified: 2013/06/25 08:11 by tschulz