{"id":1318,"date":"2019-04-28T23:36:32","date_gmt":"2019-04-28T15:36:32","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=1318"},"modified":"2019-04-29T13:07:39","modified_gmt":"2019-04-29T05:07:39","slug":"setfacl","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/setfacl","title":{"rendered":"setfacl\u547d\u4ee4 – \u8bbe\u7f6e\u6587\u4ef6ACL\u89c4\u5219"},"content":{"rendered":"\n

setfacl\u7684\u82f1\u6587\u5168\u79f0\u662f\u201c set file access control list \u201d,\u5373\u201c\u8bbe\u7f6e\u6587\u4ef6\u8bbf\u95ee\u63a7\u5236\u5217\u8868\u201d\u3002\u6539\u547d\u4ee4\u53ef\u4ee5\u66f4\u7cbe\u786e\u7684\u63a7\u5236\u6743\u9650\u7684\u5206\u914d\uff0c\u6bd4\u5982\u8ba9\u67d0\u4e00\u4e2a\u7528\u6237\u5bf9\u67d0\u4e00\u4e2a\u6587\u4ef6\u5177\u6709\u67d0\u79cd\u6743\u9650\u3002<\/p>\n\n\n\n

ACL\u6307\u6587\u4ef6\u7684\u6240\u6709\u8005\u3001\u6240\u5c5e\u7ec4\u3001\u5176\u4ed6\u4eba\u7684\u8bfb\/\u5199\/\u6267\u884c\u4e4b\u5916\u7684\u7279\u6b8a\u7684\u6743\u9650\uff0c \u5bf9\u4e8e\u9700\u8981\u7279\u6b8a\u6743\u9650\u7684\u4f7f\u7528\u72b6\u51b5\u6709\u4e00\u5b9a\u5e2e\u52a9\u3002 \u5982\uff0c\u67d0\u4e00\u4e2a\u6587\u4ef6\uff0c\u4e0d\u8ba9\u5355\u4e00\u7684\u67d0\u4e2a\u7528\u6237\u8bbf\u95ee\u3002 <\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>setfacl [\u53c2\u6570] [\u6587\u4ef6]<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n
-m <\/td>--modify-acl \u66f4\u6539\u6587\u4ef6\u7684\u8bbf\u95ee\u63a7\u5236\u5217\u8868 <\/td><\/tr>
-M <\/td>--modify-file=file \u4ece\u6587\u4ef6\u8bfb\u53d6\u8bbf\u95ee\u63a7\u5236\u5217\u8868\u6761\u76ee\u66f4\u6539 <\/td><\/tr>
-x <\/td>--remove=acl \u6839\u636e\u6587\u4ef6\u4e2d\u8bbf\u95ee\u63a7\u5236\u5217\u8868\u79fb\u9664\u6761\u76ee <\/td><\/tr>
-X<\/td>--remove-file=file \u4ece\u6587\u4ef6\u8bfb\u53d6\u8bbf\u95ee\u63a7\u5236\u5217\u8868\u6761\u76ee\u5e76\u5220\u9664 <\/td><\/tr>
-b<\/td>--remove-all \u5220\u9664\u6240\u6709\u6269\u5c55\u8bbf\u95ee\u63a7\u5236\u5217\u8868\u6761\u76ee <\/td><\/tr>
-k<\/td>--remove-default \u79fb\u9664\u9ed8\u8ba4\u8bbf\u95ee\u63a7\u5236\u5217\u8868 <\/td><\/tr>
-d<\/td>--default \u5e94\u7528\u5230\u9ed8\u8ba4\u8bbf\u95ee\u63a7\u5236\u5217\u8868\u7684\u64cd\u4f5c <\/td><\/tr>
-P <\/td>--physical \u4f9d\u7167\u81ea\u7136\u903b\u8f91\uff0c\u4e0d\u8ddf\u968f\u7b26\u53f7\u94fe\u63a5 <\/td><\/tr>
-v <\/td>--version \u663e\u793a\u7248\u672c\u5e76\u9000\u51fa <\/td><\/tr>
-R <\/td>--recursive \u9012\u5f52\u64cd\u4f5c\u5b50\u76ee\u5f55 <\/td><\/tr><\/tbody><\/table>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u4fee\u6539\u4e00\u4e2a\u6587\u4ef6\u7684acl\u6743\u9650\uff0c\u6dfb\u52a0\u4e00\u4e2a\u7528\u6237\u6743\u9650\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# getfacl test
file: test
owner: root
group: root
user::rwx
user:zwx:rw-
group::r-x
mask::rwx
other::r-x
[root@linuxcool ~]# setfacl -Rm u:zwx:rw- test
[root@linuxcool ~]# getfacl test
file: test
owner: root
group: root
user::rwx
user:zwx:rw-
group::r-x
mask::rwx
other::r-x<\/pre>\n\n\n\n

\u6e05\u9664\u4e00\u4e2a\u76ee\u5f55\u7684ACL\u6743\u9650\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# setfacl -x u:zwx test
[root@linuxcool ~]# getfacl test
file: test
owner: root
group: root
user::rwx
group::r-x
other::r-x<\/pre>\n","protected":false},"excerpt":{"rendered":"

setfacl\u7684\u82f1\u6587\u5168\u79f0\u662f\u201c set file access control list \u201d,\u5373\u201c\u8bbe\u7f6e\u6587\u4ef6\u8bbf\u95ee\u63a7 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1318"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=1318"}],"version-history":[{"count":8,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1318\/revisions"}],"predecessor-version":[{"id":1627,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1318\/revisions\/1627"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=1318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=1318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=1318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}