{"id":63630,"date":"2025-04-29T17:38:02","date_gmt":"2025-04-29T09:38:02","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63630\/"},"modified":"2025-04-29T17:38:02","modified_gmt":"2025-04-29T09:38:02","slug":"linux%e6%80%8e%e4%b9%88%e6%9b%b4%e6%94%b9%e7%94%a8%e6%88%b7%e6%9d%83%e9%99%90-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63630\/","title":{"rendered":"linux\u600e\u4e48\u66f4\u6539\u7528\u6237\u6743\u9650"},"content":{"rendered":"<blockquote><p>\n  \u8981\u5728 linux \u4e2d\u66f4\u6539\u7528\u6237\u6743\u9650\uff0c\u60a8\u53ef\u4ee5\uff1a1. \u4fee\u6539\u7528\u6237\u7ec4\uff1b2. \u4fee\u6539\u6587\u4ef6\u6743\u9650\uff1b3. \u4f7f\u7528 setfacl \u8bbe\u7f6e\u9ad8\u7ea7\u6743\u9650\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/03\/2024060312452192316.jpg\" class=\"aligncenter\" title=\"linux\u600e\u4e48\u66f4\u6539\u7528\u6237\u6743\u9650\u63d2\u56fe\" alt=\"linux\u600e\u4e48\u66f4\u6539\u7528\u6237\u6743\u9650\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 Linux \u4e2d\u66f4\u6539\u7528\u6237\u6743\u9650<\/strong><\/p>\n<p>\u66f4\u6539 Linux \u4e2d\u7684\u7528\u6237\u6743\u9650\u5bf9\u4e8e\u7ba1\u7406\u7cfb\u7edf\u548c\u786e\u4fdd\u6587\u4ef6\u5b89\u5168\u81f3\u5173\u91cd\u8981\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u5b9e\u73b0\uff1a<\/p>\n<p><strong>1. \u4fee\u6539\u7528\u6237\u7ec4<\/strong><\/p>\n<p>\u6bcf\u4e2a\u7528\u6237\u90fd\u5c5e\u4e8e\u4e00\u4e2a\u6216\u591a\u4e2a\u7528\u6237\u7ec4\uff0c\u6bcf\u4e2a\u7ec4\u90fd\u5177\u6709\u7279\u5b9a\u7684\u6743\u9650\u3002\u8981\u66f4\u6539\u7528\u6237\u7ec4\u6210\u5458\u8d44\u683c\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>usermod -a -G group_name username<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff1a\u5c06\u7528\u6237 john \u6dfb\u52a0\u5230\u7ec4 admin\uff1a<\/p>\n<pre>usermod -a -G admin john<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u4fee\u6539\u6587\u4ef6\u6743\u9650<\/strong><\/p>\n<p>\u8981\u66f4\u6539\u7279\u5b9a\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u6743\u9650\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1a<\/p>\n<pre>chmod permission_flags filename<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d permission_flags \u53ef\u4ee5\u662f\u4ee5\u4e0b\u7b26\u53f7\u7684\u4efb\u610f\u7ec4\u5408\uff1a<\/p>\n<ul>\n<li> <strong>u (\u7528\u6237)\uff1a<\/strong>\u6587\u4ef6\u6240\u6709\u8005\u7684\u6743\u9650<\/li>\n<li> <strong>g (\u7ec4)\uff1a<\/strong>\u6587\u4ef6\u7ec4\u7684\u6743\u9650<\/li>\n<li> <strong>o (\u5176\u4ed6)\uff1a<\/strong>\u6240\u6709\u5176\u4ed6\u7528\u6237\u7684\u6743\u9650<\/li>\n<li> <strong>a (\u6240\u6709)\uff1a<\/strong>\u6240\u6709\u7528\u6237\u7684\u6743\u9650<\/li>\n<li> <strong>r (\u8bfb\u53d6)\uff1a<\/strong>\u8bfb\u53d6\u6587\u4ef6\u7684\u6743\u9650<\/li>\n<li> <strong>w (\u5199\u5165)\uff1a<\/strong>\u5199\u5165\u6587\u4ef6\u7684\u6743\u9650<\/li>\n<li> <strong>x (\u6267\u884c)\uff1a<\/strong>\u6267\u884c\u6587\u4ef6\u7684\u6743\u9650<\/li>\n<\/ul>\n<p>\u4f8b\u5982\uff1a\u6388\u4e88\u7528\u6237 john \u5bf9\u6587\u4ef6 myfile \u7684\u8bfb\u53d6\u548c\u5199\u5165\u6743\u9650\uff1a<\/p>\n<pre>chmod u+rw myfile<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u4f7f\u7528 setfacl \u8bbe\u7f6e\u9ad8\u7ea7\u6743\u9650<\/strong><\/p>\n<p>setfacl \u547d\u4ee4\u5141\u8bb8\u60a8\u8bbe\u7f6e\u66f4\u9ad8\u7ea7\u7684\u6743\u9650\uff0c\u4f8b\u5982\u6388\u4e88\u7279\u5b9a\u7528\u6237\u5bf9\u6587\u4ef6\u7684\u6267\u884c\u6743\u9650\uff0c\u800c\u5176\u4ed6\u7528\u6237\u6ca1\u6709\u6b64\u6743\u9650\uff1a<\/p>\n<pre>setfacl -m u:username:permission filename<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d permission \u53ef\u4ee5\u662f\u4e0a\u9762\u5217\u51fa\u7684\u4efb\u4f55\u6743\u9650\u7b26\u53f7\u3002<\/p>\n<p>\u4f8b\u5982\uff1a\u6388\u4e88\u7528\u6237 john \u5bf9\u6587\u4ef6 myfile \u7684\u6267\u884c\u6743\u9650\uff1a<\/p>\n<pre>setfacl -m u:john:x myfile<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u66f4\u6539\u7528\u6237\u6743\u9650\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u5728 linux \u4e2d\u66f4\u6539\u7528\u6237\u6743\u9650\uff0c\u60a8\u53ef\u4ee5\uff1a1. \u4fee\u6539\u7528\u6237\u7ec4\uff1b2. \u4fee\u6539\u6587\u4ef6\u6743\u9650\uff1b3. \u4f7f\u7528 setfacl \u8bbe\u7f6e\u9ad8\u7ea7\u6743\u9650\u3002 \u5982\u4f55\u5728 Linux \u4e2d\u66f4\u6539\u7528\u6237\u6743\u9650 \u66f4\u6539 Linux \u4e2d\u7684\u7528\u6237\u6743\u9650\u5bf9\u4e8e\u7ba1\u7406\u7cfb\u7edf\u548c\u786e\u4fdd\u6587\u4ef6\u5b89\u5168\u81f3\u5173\u91cd\u8981\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u5b9e\u73b0\uff1a 1. \u4fee\u6539\u7528\u6237\u7ec4 \u6bcf\u4e2a\u7528\u6237\u90fd\u5c5e\u4e8e\u4e00\u4e2a\u6216\u591a\u4e2a\u7528\u6237\u7ec4\uff0c\u6bcf\u4e2a\u7ec4\u90fd\u5177\u6709\u7279\u5b9a\u7684\u6743\u9650\u3002\u8981\u66f4\u6539\u7528\u6237\u7ec4\u6210\u5458\u8d44\u683c\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a usermod -a -G group_name username \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff1a\u5c06\u7528\u6237 john \u6dfb\u52a0\u5230\u7ec4 admin\uff1a usermod -a -G admin john \u767b\u5f55\u540e\u590d\u5236 2. \u4fee\u6539\u6587\u4ef6\u6743\u9650 \u8981\u66f4\u6539\u7279\u5b9a\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u6743\u9650\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1a chmod permission_flags filename \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d permission_flags \u53ef\u4ee5\u662f\u4ee5\u4e0b\u7b26\u53f7\u7684\u4efb\u610f\u7ec4\u5408\uff1a u (\u7528\u6237)\uff1a\u6587\u4ef6\u6240\u6709\u8005\u7684\u6743\u9650 g (\u7ec4)\uff1a\u6587\u4ef6\u7ec4\u7684\u6743\u9650 o (\u5176\u4ed6)\uff1a\u6240\u6709\u5176\u4ed6\u7528\u6237\u7684\u6743\u9650 a (\u6240\u6709)\uff1a\u6240\u6709\u7528\u6237\u7684\u6743\u9650 r (\u8bfb\u53d6)\uff1a\u8bfb\u53d6\u6587\u4ef6\u7684\u6743\u9650 w (\u5199\u5165)\uff1a\u5199\u5165\u6587\u4ef6\u7684\u6743\u9650 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63630","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63630","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=63630"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63630\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}