The use of RHCE7 management Ii-6acl

Source: Internet
Author: User

ACLs allow fine-grained permissions to be assigned to files. In addition to the standard file owners, group owners, and other file permissions, you can also specify users or groups, as well as user and group permissions that are determined by the UID or GUID.

Command:

setfacl setting ACL policies

Getfacl viewing ACL policies

[Email protected] ~]# Setfacl--Helpsetfacl2.2.Wuyi--Setfile access Control Listsusage:setfacl [-BKNDRLP] {-m|-m|-x|-X ...} File ...-M,--modify=ACL Modify the current ACL (s) of file (s) #设置文件或目录ACL规则-M,--modify-file=file read ACL entries to modify fromfile #从文件读取ACL规则-X,--remove=acl remove entries fromThe ACL (s) of file (s) #删除ACL规则-X,--remove-file=file read ACL entries to remove fromfile #从文件读取ACL规则, and delete-B,--remove-All Remove the extended ACL entries #删除所有扩展ACL规则, the basic ACL rule is preserved-K,--remove-defaultRemove thedefaultACL #删除默认ACL规则, if there is no default ACL rule, do not prompt--Set=aclSetthe ACL of file (s), replacing the current ACL #--Set-file=file read ACL entries toSet  fromfile--mask Dorecalculate the effective rights mask #重新计算有效权限 even if ACL mask is explicitly specified-N,--no-mask Don'T recalculate the effective rights mask #不要重新计算有效权限-D,--defaultOperations apply to thedefaultACL #设置默认ACL规则, just for the directory-R,--recursive recurse into subdirectories #递归设置ACL规则-L,--logical logical Walk, follow symbolic links-P,--physical physical Walk, DoNot follow symbolic links--restore=file Restore ACLs (inverse of ' getfacl-r')--test test mode (ACLs is not modified)-V,--version print version and Exit-H,--help ThisHelp text
[Email protected] ~]# mkdir/Sharedata[[email protected]~]# cp/etc/passwd/sharedata/[[Email protected]~]# useradd usera[[email protected]~]# useradd userb[[email protected]~]# useradd userc[[email protected]~]# Echo'USERABC'|PASSWD--stdin userachanging Password forUser Usera.passwd:all authentication tokens updated successfully. [[Email protected]~]# Echo'USERABC'|PASSWD--stdin userbchanging Password forUser Userb.passwd:all authentication tokens updated successfully. [[Email protected]~]# Echo'USERABC'|PASSWD--stdin usercchanging Password forUser Userc.passwd:all authentication tokens updated successfully. [[Email protected]~]# cd/sharedata/[email protected] sharedata]# lltotal4-rw-r--r--1Root root2044Oct8  A: -Passwd[[email protected] sharedata]# setfacl-m u:usera:r passwd[[email protected] sharedata]# setfacl-m U:USERB:RW passwd[[email protected] sharedata]# setfacl-m u:userc:rwx passwd[[email protected] sharedata]# getfacl passwd# file:passwd# owner:root# group:rootuser::rw-User:usera:r--USER:USERB:RW-User:userc:rwxgroup::r--Mask::rwxother::r--

If you want the ACL to inherit the data in the directory, you will typically set the default permissions for this directory

The file owner can set ACLs on a single file or directory. New files and subdirectories can automatically inherit ACL settings from the parent directory default ACL. Similar to regular file access rules, the parent directory hierarchy needs to set at least additional execution permissions to enable access for the specified user and the specified group.

[Email protected] ~]# mkdir/Sharedata[[email protected] sharedata]# setfacl-M d:u:usera:rwx/sharedata/[email protected] sharedata]# su-useralast Login:thu Oct8  A: -: $Cst -On pts/0[[Email protected]~]$ cd/sharedata/[email protected] sharedata]$ touche Userabash:touche:command not found ... Similar Command is:'Touch'[[email protected] sharedata]$ Touch useratouch:cannot Touch ' UserA ': Permission denied[[email protected] sharedata] $ exitlogout[[email protected] sharedata]# mkdir-p/sharedata/pub[[email protected] sharedata]# su-useralast Login:thu Oct8  A: -:GenevaCst -On pts/0[[Email protected]~]$ cd/sharedata/pub/[[email protected] pub]$ Touch Usera[[email protected] pub]$ CD. [[email protected] sharedata]$ Touch useratouch:cannot Touch ' UserA ': Permission denied

ACL Mask
A mask definition grants the maximum permissions for a specified user group, group owner, and a specified group. Do not restrict permissions for file owners or other users
If mask is set, and mask is compared, final acquisition is the least privilege in both

[Email protected]/]# CD sharedata/[email protected] sharedata]# CP/etc/passwd. [Email protected] sharedata]# Setfacl-m u:usera:r passwd[[email protected] sharedata]# setfacl-m U:USERB:RW passwd[[email protected] sharedata]# setfacl-m u:userc:rwx passwd[[email protected] sharedata]# getfacl passwd# file:passwd# owner:root# group:rootuser::rw-User:usera:r--USER:USERB:RW-User:userc:rwxgroup::r--Mask::rwxother::r--[email protected] sharedata]# Setfacl-m m:r passwd[[email protected] sharedata]# getfacl passwd# file:passwd# owner:root# group:rootuser::rw-User:usera:r--USER:USERB:RW-#effective: r--user:userc:rwx #effective: R--Group::r--Mask::r--Other::r--[email protected] sharedata]# Setfacl-m m:rwx passwd[[email protected] sharedata]# getfacl passwd# file:passwd# owner:root# group:rootuser::rw-User:usera:r--USER:USERB:RW-User:userc:rwxgroup::r--Mask::rwxother::r--

The use of RHCE7 management Ii-6acl

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.