Natarajan's blog

Saturday, September 25, 2004

 

Access Control Lists in Linux

Access Control Lists (ACL from now on) is a mechanism by which you can have fine grained file access permissions.

A scenario to explain the utility of ACL

How many times you wanted two users to have access over a particular file, and you had to create a group with the concerned users as members? ACL comes to your rescue in such a situation. You can just give the multiple users permissions for the file without having to create a group.

Pre-requisites for ACL

Example

I have a directory natty_kumar for which users natty and kumar need to be given read/write/execute access.

total 8
drwxr-xr-x 2 natty natty 4096 Sep 25 23:27 natty_kumar
-rw-r--r-- 1 natty natty 1406 Sep 25 23:28 acl.html
To see the current access control list for the directory natty_kumar use the following command

[natty@localhost linux]$ getfacl natty_kumar/
# file: natty_kumar
# owner: natty
# group: natty
user::rwx
group::r-x
other::r-x
Now I need to give permissions to user kumar for this directory

[natty@localhost linux]$ setfacl -m u:kumar:rwx natty_kumar/
You can see the new access permissions for the directory with

[natty@localhost linux]$ getfacl natty_kumar/
# file: natty_kumar
# owner: natty
# group: natty
user::rwx
user:kumar:rwx
group::r-x
mask::rwx
other::r-x
Now user kumar has read/write/execute permissions on the natty_kumar directory.
To revoke all ACL permissions given, you can use

[natty@localhost linux]$ setfacl -b natty_kumar
This is a small intro to ACLs. For further reading:


Hope you found it useful.

Natarajan

Comments: Post a Comment



<< Home

Archives

March 2004   April 2004   May 2004   June 2004   August 2004   September 2004   November 2004   February 2005   May 2005  

This page is powered by Blogger. Isn't yours?