Wednesday, January 9, 2013

ACL (Access Control List)



What is ACL? –
              File and directories have permission sets for the owner of the file the group associated with the file and all other user for the system. How ever these permission sets have limitation. For example different permission can not be configured for different user Thus access control list (ACL) was implemented. ACLs are supported in all the major Linux file systems — ext2, ext3, XFS, ReiserFS, and JFS (begin ritual debate over which filesystem is best). ACLs on Linux are still bleeding-edge, though, with the major distributions just beginning to include them.

Applying ACL –

STEP 1 –
         Before using ACL for a file or directory. The partition for the file or directory must be mounted with ACL support. If a local ext3 file system. It can mount with the following command.
#mount   -t   ext3   -o   acl   /dev/hda7   /mnt



Ext3 – is file system,
/dev/had7 - is the partition on which the (/) root is mounted.
/mnt – is the directory where I mounted the ACL.

 

For mount it permanently –

/dev/hda7
/mnt
Ext3,acl
Defaults
 0  0

STEP 2 –
       Now set the ACL permission on the users or groups.
#mkdir   ajay   (at 1st I created a directory for understanding ACL)


#getfacl   ajay/
                  The above command is used to check the detail of permissions.

Applying ACL on users –

#setfacl   -m   u:ram:r-x   ajay/

         ram = user name
         r-x = type of permission for ram user.
         ajay = is directory
Now ajay directory is permitted for read and execute.

Applying ACL for groups

#setfacl   -m   g:raja:rwx   ajay/

         raja = group name
         rwx = type of permission for raja group
         ajay = is directory.

                                            ACL TYPES
There are two types of ACL
1.     Access ACLAccess ACL Is the access control list for specific file or directory.
2.     Default ACLCan only be associated with a directory if files with in the directory dose not have an access ACL. It uses the rules of the default ACL for the directory default ACL are option.

ACL can be configuration:-
~ Per user.
~ Per group.
~ via the effective rights mask.
~ For users not in the user group for the file.