{"id":223748,"date":"2021-08-11T10:46:38","date_gmt":"2021-08-11T02:46:38","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=223748"},"modified":"2021-07-29T08:46:51","modified_gmt":"2021-07-29T00:46:51","slug":"linux-file-right","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-file-right.html","title":{"rendered":"linux\u6587\u4ef6\u6743\u9650"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u201clinux\u7684\u5b97\u65e8\u662f\uff1a\u4e00\u5207\u7686\u6587\u4ef6~\u4eca\u5929\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e00\u4e0b\u6587\u4ef6\u6743\u9650\u201d<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

1\u3001\u6587\u4ef6\u7c7b\u578b\u5171\u4e03\u79cd\uff1a<\/strong><\/div>\n
d    \u76ee\u5f55\r\nl    \u7b26\u53f7\u94fe\u63a5\uff08\u8f6f\u786c\u8fde\u63a5\uff09\r\ns    \u5957\u63a5\u5b57\u6587\u4ef6\r\nb    \u5757\u8bbe\u5907\u6587\u4ef6\r\nc    \u5b57\u7b26\u8bbe\u5907\u6587\u4ef6\r\np    \u547d\u540d\u7ba1\u9053\u6587\u4ef6\r\n-    \u666e\u901a\u6587\u4ef6\uff0c\u6216\u8005\u66f4\u51c6\u786e\u7684\u8bf4\uff0c\u4e0d\u5c5e\u4e8e\u4ee5\u4e0a\u51e0\u79cd\u7c7b\u578b\u7684\u6587\u4ef6\r\n<\/pre>\n
2\u3001 \u6587\u4ef6\u6743\u9650\u8bbe\u7f6e<\/strong><\/div>\n
chmod [who] operator [permission] filename<\/pre>\n
who\u7684\u542b\u4e49\uff1a<\/strong><\/span><\/div>\n
u \u6587\u4ef6\u5c5e\u4e3b\u6743\u9650\r\ng \u540c\u7ec4\u7528\u6237\u6743\u9650\r\no \u5176\u4ed6\u7528\u6237\u6743\u9650\r\na \u6240\u6709\u7528\u6237\uff08u+g+o\uff09<\/pre>\n
operator\u7684\u542b\u4e49\uff1a<\/strong><\/span><\/div>\n
+ \u589e\u52a0\u6743\u9650\r\n- \u53d6\u6d88\u6743\u9650\r\n= \u8bbe\u5b9a\u6743\u9650<\/pre>\n
permission\u7684\u542b\u4e49\uff1a<\/strong><\/span><\/div>\n
r \u8bfb\u6743\u9650\r\nw \u5199\u6743\u9650\r\nx \u6267\u884c\u6743\u9650\r\nt \u7c98\u6027\u4f4d\uff0a\r\nl \u7ed9\u6587\u4ef6\u52a0\u9501\uff0c\u4f7f\u5176\u4ed6\u7528\u6237\u65e0\u6cd5\u8bbf\u95ee\r\nu.g.o \u9488\u5bf9\u6587\u4ef6\u5c5e\u4e3b\uff0c\u540c\u7ec4\u7528\u6237\u4ee5\u53ca\u5176\u4ed6\u7528\u6237\u7684\u64cd\u4f5c<\/pre>\n

\u7c98\u6027\u4f4d\u201ct\u201d \u5982\u679c\u5728\u4e00\u4e2a\u76ee\u5f55\u4e0a\u51fa\u73b0\u201ct\u201d\u4f4d\uff0c\u90a3\u4e48\u8868\u793a\u8be5\u76ee\u5f55\u53ea\u6709\u5176\u5c5e\u4e3b\u624d\u53ef\u4ee5\u5220\u9664\uff1b\u5982\u679c\u51fa\u73b0\u5728\u6587\u4ef6\u5217\u8868\uff0c\u90a3\u4e48\u610f\u5473\u7740\u8be5\u811a\u672c\u6216\u8005\u7a0b\u5e8f\u5728\u6267\u884c\u65f6\u4f1a\u88ab\u653e\u5728\u4ea4\u6362\u533a\uff08\u865a\u5b58\uff09<\/p>\n

\u4fee\u6539\u6743\u9650\uff08\u7b26\u53f7\u6a21\u5f0f\uff09\uff1a<\/strong><\/span><\/div>\n
chmod u+x hello.py\r\nchmod +w hello.py\r\nchmod -R +x runall.sh : -R \u8868\u793a\u9012\u5f52\u4fee\u6539\uff0c\u5305\u62ec\u8be5\u6587\u4ef6\u5939\u4e0b\u7684\u5b50\u6587\u4ef6<\/pre>\n
\u4fee\u6539\u6743\u9650\uff08\u7edd\u5bf9\u6a21\u5f0f\uff0c\u4e0d\u540c\u6570\u5b57\u4ee3\u8868\u4e0d\u540c\u6743\u9650\uff09\uff1a<\/strong><\/span><\/div>\n
chmod 664 hello.py\r\nchmod 777 *<\/pre>\n

<<< \u7edd\u5bf9\u6a21\u5f0f\u4e0b\uff0c\u7528\u6570\u5b57\u4ee3\u66ff\u76f8\u5e94\u7684\u6743\u9650\u4f4d\uff0c\u53ef\u8bfb\u7528\u6570\u5b574\uff0c\u53ef\u5199\u7528\u6570\u5b572\uff0c\u53ef\u6267\u884c\u7528\u6570\u5b571\u8868\u793a\uff0c\u4fee\u6539\u540c\u4e00\u4e2a\u7528\u6237\uff08u\u6216\u8005g\u6216\u8005o\uff09\u6743\u9650\u53ea\u9700\u8981\u5c06\u5bf9\u5e94\u7684\u6743\u9650\u4f4d\u7684\u503c\u76f8\u52a0\uff1a\u6bd4\u5982\uff0c6\u4ee3\u8868\u53ef\u8bfb\u53ef\u5199\u3002<\/p>\n

<<<\u4fee\u6539\u591a\u4e2a\u7528\u6237\u7684\u4e0d\u540c\u6743\u9650\u9700\u8981\u591a\u4e2a\u6570\u5b57\u4e00\u5e76\u8bbe\u7f6e\uff0c\u7b2c\u4e00\u4e2a\u6570\u5b57\u4ee3\u8868\u5c5e\u4e3b\u7528\u6237\uff0c\u7b2c\u4e8c\u4e2a\u6570\u5b57\u4ee3\u8868\u540c\u7ec4\u7528\u6237\uff0c\u7b2c\u4e09\u4e2a\u6570\u5b57\u4ee3\u8868\u5176\u4ed6\u7528\u6237\uff1a\u6bd4\u5982\uff0c664\u4ee3\u8868\u5c5e\u4e3b\u7528\u6237\u53ef\u8bfb\u53ef\u5199\uff0c\u540c\u7ec4\u7528\u6237\u53ef\u8bfb\u53ef\u5199\uff0c\u5176\u4ed6\u7ec4\u53ef\u8bfb<\/p>\n

\u5728\u7edd\u5bf9\u6a21\u5f0f\u4e0b\u4fee\u6539\u6743\u9650\u5e94\u8be5\u6709\u56db\u4f4d\u6570\u5b57664\u5176\u5b9e\u662f0664\u3002\u7b2c\u4e00\u4f4d\u662f\u8bbe\u7f6esuid\u548cguid\u7684\uff0c\u4e00\u65e6\u8bbe\u7f6e\u4e86\u8be5\u4f4d\uff0c\u90a3\u4e48\u5728\u53ef\u6267\u884c\u6743\u9650\u4f4dx\u4e0a\u4f1a\u51fa\u73b0\u4e00\u4e2as\uff1asuid\uff08\u6743\u9650\u6570\u5b574\uff09\u610f\u5473\u7740\u5982\u679c\u67d0\u4e2a\u7528\u6237\u5bf9\u5c5e\u4e8e\u81ea\u5df1\u7684shell\u811a\u672c\u8bbe\u7f6e\u4e86\u8fd9\u79cd\u6743\u9650\uff0c\u90a3\u4e48\u5176\u4ed6\u7528\u6237\u5728\u6267\u884c\u8fd9\u4e00\u811a\u672c\u65f6\u4e5f\u4f1a\u5177\u6709\u5176\u5c5e\u4e3b\u76f8\u5e94\u7684\u6743\u9650\uff1bguid\uff08\u6743\u9650\u6570\u5b572\uff09\u610f\u5473\u7740\u6267\u884c\u76f8\u5e94\u7684\u811a\u672c\u7684\u7528\u6237\u5c06\u5177\u6709\u8be5\u6587\u4ef6\u6240\u5c5e\u7528\u6237\u7ec4\u4e2d\u7528\u6237\u7684\u6743\u9650\u3002<\/p>\n

\u4fee\u6539\u6587\u4ef6\u6240\u5c5e\uff1a<\/strong><\/span><\/div>\n
\u8bed\u6cd5\uff1a chown -R -h owner file<\/pre>\n

-R\u610f\u5473\u7740\u5bf9\u6240\u6709\u5b50\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u505a\u540c\u6837\u7684\u4fee\u6539\uff1b -h\u610f\u5473\u7740\u5728\u6539\u53d8\u7b26\u53f7\u94fe\u63a5\u6587\u4ef6\u7684\u5c5e\u4e3b\u65f6\u4e0d\u5f71\u54cd\u8be5\u94fe\u63a5\u6240\u6307\u5411\u7684\u76ee\u6807\u6587\u4ef6\u3002<\/p>\n

chown root hello.py \uff1a\u5c06hello.py\u6587\u4ef6\u7684\u6240\u5c5e\u4fee\u6539\u4e3aroot<\/pre>\n
\u4fee\u6539\u6587\u4ef6\u6240\u5728\u7ec4\uff1a<\/strong><\/span><\/div>\n

\u8bed\u6cd5\u7c7b\u4f3c\u4e8echown<\/p>\n

chgrp root hello.py \uff1a\u5c06hello.py\u6587\u4ef6\u6240\u5728\u7ec4\u4fee\u6539\u4e3aroot<\/pre>\n
\u521b\u5efa\u6587\u4ef6\u9ed8\u8ba4\u6743\u9650\uff1a<\/strong><\/span><\/div>\n

umask\u547d\u4ee4\u786e\u5b9a\u521b\u5efa\u6587\u4ef6\u7684\u7f3a\u7701\u6743\u9650\uff0c\u4e00\u822cumask\u5728\/etc\/profile\u6587\u4ef6\u4e2d\u8bbe\u7f6e\uff0c\u6bcf\u4e2a\u7528\u6237\u767b\u5f55\u65f6\u4f1a\u5f15\u7528\u8be5\u6587\u4ef6\uff0c\u5982\u679c\u8bbe\u7f6eumask\uff0c\u90a3\u4e48\u53ef\u4ee5\u5728$HOME\u4e0b\u7684.profile\u6216\u8005bash_profile\u6587\u4ef6\u4e2d\u4fdd\u5b58\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

d \u76ee\u5f55 l \u7b26\u53f7\u94fe\u63a5\uff08\u8f6f\u786c\u8fde\u63a5\uff09 s \u5957\u63a5\u5b57\u6587\u4ef6 b \u5757\u8bbe\u5907\u6587\u4ef6 c \u5b57\u7b26\u8bbe\u5907\u6587\u4ef6 p \u547d\u540d\u7ba1\u9053\u6587\u4ef6 – \u666e […]<\/p>\n","protected":false},"author":1469,"featured_media":223757,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-223748","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/223748","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1469"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=223748"}],"version-history":[{"count":8,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/223748\/revisions"}],"predecessor-version":[{"id":223758,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/223748\/revisions\/223758"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/223757"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=223748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=223748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=223748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}