Linux and open source articles and tutorials based on real world projects and deployments

Using ACLs (Access Control Lists) with Linux filesystem

This article was written specifically for Red Hat and CentOS but concept will be the same for other Linux distributions.

In this article we will go over ACLs for Linux and how they can be used to control access to files and directory’s on Linux file system. ACLs start with ownership and permissions. ACL on Linux file system provides additional much more flexible mechanize to manage permissions.

To use ACL we will need to configure file system with ACL option. With NFS version 4, these ACLs can be shared over a network.Requirements

1. Kernel 2.4 or 2.6

2. ACL Utilities
Check to make sure acl package already installed

[root@rh3 ~]# rpm -q acl
acl-2.2.49-6.el6.x86_64

If not insyall it with

[root@rh3 ~]# yum install acl

3. Before a file or directory can be configured with ACLs, you need to mount the associated file system with the same attribute. If you’re just testing a system for ACL, you can remount an existing partition appropriately. For example, if /home is mounted on /dev/sda3, we can remount it with ACL using the following command:

[root@rh3 ~]#mount -o remount -o acl /dev/sda3 /home

To confirm that the /home directory is mounted with the acl option, run the mount command . You will notice acl in the output.

[root@rh3 ~]#/dev/sda3 on /home type ext4 (rw,acl)

Working with ACLs

All files should already be configured with ACLs. the following command displays the current ACLs for the test1 file