Friday, January 22, 2010

ACL continued...

लिनक्स संबंधी सभी डाउन लॉड् के लिए निम्न लिंक क्लिक करें:


हिन्दी लिनक्स ब्लॉग का एड्रेस:


Setting ACL

setfacl

This utility sets the ACL for files and directories. We should use –m option to add or change the ACL for a file or directory:

setfacl -m rules files

The rules must be used in the following formats. We can use multiple rules in the same command by separating them with commas.

o:perms
It sets the ACL for users other than those in group for the file.

u:uid:perms
It sets the ACL for user. We should specify the user name or UID in place of uid.

g:gid:perms
It sets the ACL for group. We should specify the group name or GID in place of gid.

m:perms
Its sets the effective rights mask. It is union of all the permissions of owning group and all the user and group entries.

Permissions should be a combination of r (read), w (write) and x(execute). The white spaces are ignored. If the file or directory already has ACL, and we use setfacl command for it, then additional rules are added to the existing ACL. For example, to give read and write permission to user anil, we will use the following command:

# setfacl -m u:anil:rw /home/project

To remove all permission of user, group or others, we can use -x option. Here we will not specify any permission:

setfacl -x rules files

For example:

# setfacl -x u:502 /home/project
Setting default ACL

To set default ACL, we will have to add d: before the rule and instead of file name we will have to specify a directory name. For example, to set the default ACL for /home/shared directory for others to read and execute, we can use the following command:

# setfacl -m d:o:rx /home/shared

Retrieving ACL

To find the existing ACL of a file or directory, we will use the following command syntax:
getfacl filename

It will return the output similar to this:

user::rw-
user:vijai:r- -
group:: r- -


No comments:

Post a Comment