ACL is mainly for users, groups, and default attributes. 1. enable ACL [root @ lyy ~] # Mount-oremount, enable acl/home [root @ lyy ~] # Mount View/dev/hda2on/typeext3 (rw) procon/proctypeproc (rw) sysfs...
ACL is mainly for users, groups, and default attributes.
1. enable ACL
[Root @ lyy ~] # Mount-o remount, acl/home enabled
[Root @ lyy ~] # Mount View
/Dev/hda2 on/type ext3 (rw)
Proc on/proc type proc (rw)
Sysfs on/sys type sysfs (rw)
Devpts on/dev/pts type devpts (rw, gid = 5, mode = 620)
/Dev/hda5 on/home type ext3 (rw, usrquota, kgquota, acl) enable the file system ACL
/Dev/hda1 on/boot type ext3 (rw)
Enable/etc/fstab automatically upon system startup. add the acl after ULTS ults.
LABEL =/home ext3 defaults, acl 1 2
In fact, the partition created during system installation in RHEL5.x supports ACL by default. If the partition is created after the system is installed, add
The preceding parameters.
ACL settings: getfacl, setfacl
Getfacl: Get the ACL settings of a file/directory.
Setfacl: set ACL rules for a file/directory.
Setfacl command usage:
-M sets the subsequent acl parameters for the file. it cannot be used with-x.
-X delete subsequent parameters
-B: delete the acl settings.
-K remove preset acl parameters
-R recursive settings, including sub-directory settings
-D: preset acl parameters, which only apply to the Directory
II. example: use setacl to test the read and write permissions of acl_test to pcca.
[Root @ lyy test] # touch acltest create a file
[Root @ lyy test] # ll acltest
-Rw-r -- 1 root 0 12-07 20:28 acltest
[Root @ lyy test] # setfacl-m u: pcca: rw acltest: set pcca to have read and write permissions
[Root @ lyy test] # ll
Total 4
-Rw-r -- + 1 root 0 12-07 20:28 acltest
You can use ll to view and find that the permissions are more
Simply use setfacl-m u: User: permission to set permissions.
3. view the getfacl permission
[Root @ lyy test] # getfacl acltest
# File: acltest description
# Owner: root owner
# Group: root group
User: rw-the user list is empty, representing the permissions of the owner
User: pcca: rw-authorized read/write for pcca
Group: r -- group
Mask: rw-preset valid permissions
Other: r -- others
Mask: The permissions set by users and groups must be within the mask range.
By default, the acl is not inherited by the sub-directory. to inherit the acl, use the parameter d.
Example:
[Root @ lyy tmp] # setfacl-m g: pc: rwx test
[Root @ lyy tmp] # cd test
[Root @ lyy test] # mkdir group
[Root @ lyy test] # ll group/-d
Drwxr-xr-x 2 root 4096 12-07 group/
Use the d parameter to inherit the sub-directory
[Root @ lyy test] # setfacl-m d: g: pc: rwx./test/
[Root @ lyy test] # ll-d
Drwxr-xr-x 3 root 4096 12-07.
[Root @ lyy test] # ll test-d
Drwxr-xr-x + 2 root 4096 12-07 test
[Root @ lyy test] # cd test
[Root @ lyy test] # mkdir baidu
[Root @ lyy test] # ll
Total 8
Drwxrwxr-x + 2 root 4096 12-07 baidu
Command format: setfacl-m d: u: User: permission
4. cancel ACL
Command: setfacl-B file name
Example:
[Root @ lyy test] # setfacl-B test/cancel ACL
[Root @ lyy test] # ll
Drwxr-xr-x 3 root 4096 12-07 test NO +
Author "Liyy study notes"