{"id":55798,"date":"2023-09-27T22:42:02","date_gmt":"2023-09-27T14:42:02","guid":{"rendered":"https:\/\/docs.pingcode.com\/?p=55798"},"modified":"2023-09-27T22:42:10","modified_gmt":"2023-09-27T14:42:10","slug":"linux%e4%b8%ad%e7%9a%84rws%e6%98%af%e4%bb%80%e4%b9%88%e6%84%8f%e6%80%9d","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/55798.html","title":{"rendered":"linux\u4e2d\u7684rws\u662f\u4ec0\u4e48\u610f\u601d"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote\">\n<p>\u5728Linux\u7cfb\u7edf\u4e2d\uff0cRWS\uff08Read, Write, Execute\uff09\u8868\u793a\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u8bbf\u95ee\u6743\u9650\u3002\u8fd9\u662f\u7531\u4e09\u4e2a\u5b57\u7b26\u7ec4\u6210\u7684\u6743\u9650\u6807\u8bc6\u7b26\uff0c\u5176\u4e2d\u201cR\u201d\u8868\u793a\u8bfb\u53d6\u6743\u9650\uff0c\u201cW\u201d\u8868\u793a\u5199\u5165\u6743\u9650\uff0c\u800c\u201cS\u201d\u901a\u5e38\u8868\u793a\u7279\u6b8a\u6743\u9650\u6216\u96c6\u5408\u6743\u9650\u3002\u5177\u4f53\u6765\u8bf4\uff0cRWS\u6807\u8bc6\u7b26\u662f\u7528\u6765\u89c4\u5b9a\u4e0d\u540c\u7528\u6237\u6216\u7528\u6237\u7ec4\u5bf9\u67d0\u4e00\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u8bbf\u95ee\u6743\u9650\u7ea7\u522b\u3002\u8fd9\u4e9b\u6743\u9650\u53ef\u4ee5\u7528<strong>chmod<\/strong>\u547d\u4ee4\u8fdb\u884c\u8bbe\u7f6e\u548c\u4fee\u6539\u3002<strong>1\u3001\u8bfb\u53d6\uff08R\uff09<\/strong>\uff1a\u5141\u8bb8\u7528\u6237\u8bfb\u53d6\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u5185\u5bb9\u3002<strong>2\u3001\u5199\u5165\uff08W\uff09<\/strong>\uff1a\u5141\u8bb8\u7528\u6237\u7f16\u8f91\u6216\u5220\u9664\u6587\u4ef6\u3002<strong>3\u3001\u7279\u6b8a\uff08S\uff09<\/strong>\uff1a\u901a\u5e38\u7528\u4e8e\u6267\u884c\u6587\u4ef6\u6216\u76ee\u5f55\u7279\u6b8a\u64cd\u4f5c\u3002<\/p>\n<\/blockquote>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"680\" height=\"421\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2023\/09\/\u6dfb\u52a0\u6807\u9898-21-1-1.png?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"\" class=\"wp-image-55799\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e00\u3001RWS\u57fa\u672c\u6982\u5ff5<\/strong><\/h2>\n\n\n\n<p><strong><br><\/strong>\u5728Linux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\uff0c\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u6743\u9650\u662f\u4e00\u4e2a\u6838\u5fc3\u7684\u6982\u5ff5\uff0c\u5b83\u4fdd\u8bc1\u4e86\u7cfb\u7edf\u7684\u5b89\u5168\u6027\u548c\u7a33\u5b9a\u6027\u3002\u8fd9\u91cc\u7684RWS\u5206\u522b\u4ee3\u8868\u8bfb\u53d6\uff08Read\uff09\u3001\u5199\u5165\uff08Write\uff09\u548c\u7279\u6b8a\uff08Execute\/Special\uff09\u6743\u9650\u3002<strong>\u8fd9\u4e09\u79cd\u6743\u9650\u5408\u5728\u4e00\u8d77\uff0c\u6784\u6210\u4e86\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u8bbf\u95ee\u6743\u9650\u6807\u8bc6\u7b26<\/strong>\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e8c\u3001\u5982\u4f55\u67e5\u770b\u548c\u8bbe\u7f6eRWS<\/strong><\/h2>\n\n\n\n<p><strong><br><\/strong>\u67e5\u770b\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u6743\u9650\u901a\u5e38\u901a\u8fc7<strong>ls -l<\/strong>\u547d\u4ee4\u5b8c\u6210\uff0c\u8f93\u51fa\u7ed3\u679c\u7684\u7b2c\u4e00\u5217\u5373\u662fRWS\u6743\u9650\u3002\u8bbe\u7f6e\u6216\u66f4\u6539\u8fd9\u4e9b\u6743\u9650\u4e00\u822c\u4f7f\u7528<strong>chmod<\/strong>\u547d\u4ee4\u3002\u4f8b\u5982\uff0c\u82e5\u8981\u4e3a\u67d0\u4e2a\u6587\u4ef6\u8bbe\u7f6e\u8bfb\u3001\u5199\u3001\u6267\u884c\u6743\u9650\uff0c\u53ef\u4ee5\u4f7f\u7528<strong>chmod 777 \u6587\u4ef6\u540d<\/strong>\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e09\u3001\u6743\u9650\u8be6\u89e3<\/strong><\/h2>\n\n\n\n<p><strong><br><\/strong>1\u3001<strong>\u8bfb\u53d6\u6743\u9650\uff08R\uff09<\/strong><br>\u5141\u8bb8\u7528\u6237\u67e5\u770b\u6587\u4ef6\u7684\u5185\u5bb9\u6216\u5217\u51fa\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\u3002<br>2\u3001<strong>\u5199\u5165\u6743\u9650\uff08W\uff09<\/strong><br>\u5141\u8bb8\u7528\u6237\u7f16\u8f91\u3001\u5220\u9664\u6216\u79fb\u52a8\u6587\u4ef6\uff0c\u4e5f\u53ef\u4ee5\u5728\u5177\u6709\u5199\u6743\u9650\u7684\u76ee\u5f55\u4e2d\u521b\u5efa\u6216\u5220\u9664\u6587\u4ef6\u3002<br>3\u3001<strong>\u7279\u6b8a\u6743\u9650\uff08S\uff09<\/strong><br>\u7279\u6b8a\u6743\u9650\u5206\u4e3a\u4e24\u7c7b\uff1asetuid\u548csetgid\u3002setuid\u5728\u6587\u4ef6\u6267\u884c\u65f6\uff0c\u4f1a\u6682\u65f6\u8d4b\u4e88\u6267\u884c\u8005\u6587\u4ef6\u62e5\u6709\u8005\u7684\u6743\u9650\u3002setgid\u5219\u5728\u6587\u4ef6\u6267\u884c\u65f6\uff0c\u7ed9\u4e88\u6267\u884c\u8005\u6587\u4ef6\u6240\u5728\u7ec4\u7684\u6743\u9650\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u56db\u3001\u5e38\u89c1\u7684RWS\u7ec4\u5408<\/strong><\/h2>\n\n\n\n<p><br>Linux\u4e2d\u5e38\u89c1\u7684RWS\u7ec4\u5408\u6709<strong>rwx<\/strong>\u3001<strong>rw-<\/strong>\u3001<strong>r-x<\/strong>\u7b49\uff0c\u5176\u4e2d<strong>x<\/strong>\u4ee3\u8868\u6267\u884c\u6743\u9650\u3002\u8fd9\u4e9b\u7ec4\u5408\u53ef\u4ee5\u7528\u4e8e\u4e0d\u540c\u7684\u7528\u6237\u7ec4\uff0c\u5982\u6587\u4ef6\u62e5\u6709\u8005\u3001\u6587\u4ef6\u6240\u5728\u7ec4\u548c\u5176\u4ed6\u7528\u6237\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e94\u3001\u4e3a\u4f55RWS\u5982\u6b64\u91cd\u8981<\/strong><\/h2>\n\n\n\n<p><br>RWS\u6743\u9650\u4e0d\u4ec5\u4fdd\u8bc1\u4e86\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u5b89\u5168\uff0c\u8fd8\u6709\u52a9\u4e8e\u591a\u7528\u6237\u73af\u5883\u4e0b\u7684\u6570\u636e\u9694\u79bb\u3002\u9519\u8bef\u5730\u8bbe\u7f6eRWS\u6743\u9650\u53ef\u80fd\u5bfc\u81f4\u672a\u6388\u6743\u8bbf\u95ee\u6216\u6570\u636e\u6cc4\u9732\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u5e38\u89c1\u95ee\u7b54<\/strong><\/h2>\n\n\n\n<p><strong>1. <\/strong><strong>\u4ec0\u4e48\u662fLinux\u4e2d\u7684\u6587\u4ef6\u6743\u9650\uff1f<\/strong><\/p>\n\n\n\n<p>\u6587\u4ef6\u6743\u9650\u662fLinux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7528\u4e8e\u63a7\u5236\u5bf9\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u8bbf\u95ee\u7684\u4e00\u7ec4\u89c4\u5219\u3002\u8fd9\u4e9b\u6743\u9650\u5206\u4e3a\u8bfb\uff08r\uff09\u3001\u5199\uff08w\uff09\u3001\u548c\u6267\u884c\uff08x\uff09\u4e09\u79cd\uff0c\u7531\u6240\u6709\u8005\u3001\u7fa4\u7ec4\u548c\u5176\u4ed6\u7528\u6237\u7684\u6743\u9650\u7ec4\u6210\u3002<\/p>\n\n\n\n<p><strong>2. <\/strong><strong>\u5982\u4f55\u5728Linux\u4e2d\u67e5\u770brws\u6743\u9650\uff1f<\/strong><\/p>\n\n\n\n<p>\u5728Linux\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528<strong>ls -l<\/strong>\u547d\u4ee4\u6765\u67e5\u770b\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u6743\u9650\u3002\u5982\u679c\u4f60\u770b\u5230\u4e00\u4e2a<strong>rws<\/strong>\u5728\u6743\u9650\u5b57\u7b26\u4e32\u4e2d\uff0c\u90a3\u610f\u5473\u7740\u8be5\u6587\u4ef6\u6216\u7a0b\u5e8f\u62e5\u6709SUID\u6743\u9650\u3002<\/p>\n\n\n\n<p><strong>3. SUID<\/strong><strong>\u548crws\u6709\u4ec0\u4e48\u8054\u7cfb\uff1f<\/strong><\/p>\n\n\n\n<p>SUID\uff08Set User ID\uff09\u662f\u4e00\u79cd\u7279\u6b8a\u7684\u6587\u4ef6\u6743\u9650\uff0c\u5f53\u8bbe\u7f6e\u4e86\u8fd9\u4e2a\u6743\u9650\uff0c\u4efb\u4f55\u7528\u6237\u8fd0\u884c\u8be5\u6587\u4ef6\u65f6\uff0c\u8be5\u8fdb\u7a0b\u5c06\u4ee5\u6587\u4ef6\u6240\u6709\u8005\u7684\u8eab\u4efd\u6267\u884c\u3002\u5728\u6743\u9650\u5b57\u7b26\u4e32\u4e2d\uff0cSUID\u88ab\u8868\u793a\u4e3a<strong>rws<\/strong>\u3002<\/p>\n\n\n\n<p><strong>4. <\/strong><strong>\u5982\u4f55\u8bbe\u7f6e\u6216\u66f4\u6539rws\u6743\u9650\uff1f<\/strong><\/p>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u4f7f\u7528<strong>chmod<\/strong>\u547d\u4ee4\u6765\u8bbe\u7f6e\u6216\u66f4\u6539\u6587\u4ef6\u6743\u9650\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<strong>chmod u+s \u6587\u4ef6\u540d<\/strong>\u53ef\u4ee5\u7ed9\u6587\u4ef6\u8bbe\u7f6eSUID\u6743\u9650\uff0c\u76f8\u5e94\u5730\uff0c\u6743\u9650\u5b57\u7b26\u4e32\u4e2d\u7684<strong>x<\/strong>\u4f1a\u88ab<strong>rws<\/strong>\u66ff\u4ee3\u3002<\/p>\n\n\n\n<p><strong>5. <\/strong><strong>\u8bbe\u7f6erws\u6743\u9650\u6709\u4ec0\u4e48\u98ce\u9669\uff1f<\/strong><\/p>\n\n\n\n<p>\u7ed9\u6587\u4ef6\u8bbe\u7f6eSUID\u6743\u9650\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5b89\u5168\u98ce\u9669\u3002\u4efb\u4f55\u7528\u6237\u90fd\u53ef\u4ee5\u4ee5\u6587\u4ef6\u6240\u6709\u8005\u7684\u8eab\u4efd\u6267\u884c\u8be5\u6587\u4ef6\uff0c\u53ef\u80fd\u5bfc\u81f4\u4e0d\u53d7\u63a7\u5236\u7684\u6587\u4ef6\u8bbf\u95ee\u6216\u7cfb\u7edf\u547d\u4ee4\u6267\u884c\u3002\u56e0\u6b64\uff0c\u5e94\u8c28\u614e\u8bbe\u7f6eSUID\u6743\u9650\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Linux\u7cfb\u7edf\u4e2d\uff0cRWS\uff08Read, Write, Execute\uff09\u8868\u793a\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u8bbf\u95ee\u6743\u9650\u3002\u8fd9\u662f\u7531\u4e09\u4e2a\u5b57\u7b26 [&hellip;]","protected":false},"author":5,"featured_media":55651,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/55798"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=55798"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/55798\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/55651"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=55798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=55798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=55798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}