{"id":99929,"date":"2024-07-07T03:00:26","date_gmt":"2024-07-06T19:00:26","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=99929"},"modified":"2024-07-07T03:00:26","modified_gmt":"2024-07-06T19:00:26","slug":"linux-file-permission","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-file-permission.html","title":{"rendered":"linux \u6587\u4ef6\u6743\u9650\u89e3\u6790"},"content":{"rendered":"
linux\u7cfb\u7edf\u5185\u6709\u6863\u6848\u6709\u4e09\u79cd\u8eab\u4efd u:\u62e5\u6709\u8005 g:\u7fa4\u7ec4 o:\u5176\u4ed6\u4eba<\/p>\n
\u8fd9\u4e9b\u8eab\u4efd\u5bf9\u4e8e\u6587\u6863\u5e38\u7528\u7684\u6709\u4e0b\u9762\u6743\u9650\uff1a<\/p>\n
r\uff1a\u8bfb\u6743\u9650\uff0c\u7528\u6237\u53ef\u4ee5\u8bfb\u53d6\u6587\u6863\u7684\u5185\u5bb9\uff0c\u5982\u7528cat\uff0cmore\u67e5\u770b<\/p>\n
w\uff1a\u5199\u6743\u9650\uff0c\u7528\u6237\u53ef\u4ee5\u7f16\u8f91\u6587\u6863<\/p>\n
x\uff1a\u8be5\u76ee\u5f55\u5177\u6709\u53ef\u4ee5\u88ab\u7cfb\u7edf\u6267\u884c\u7684\u6743\u9650<\/p>\n
\u9664\u4e86\u8bfb\u5199\u6267\u884c\u6743\u9650\u5916\u7cfb\u7edf\u8fd8\u652f\u6301\u5f3a\u5236\u4f4d\uff08s\u6743\u9650\uff09\u548c\u7c98\u6ede\u4f4d\uff08t\u6743\u9650\uff09<\/p>\n
s\u6743\u9650\uff1a \u8bbe\u7f6e\u4f7f\u6587\u4ef6\u5728\u6267\u884c\u9636\u6bb5\u5177\u6709\u6587\u4ef6\u6240\u6709\u8005\u7684\u6743\u9650\uff0c\u76f8\u5f53\u4e8e\u4e34\u65f6\u62e5\u6709\u6587\u4ef6\u6240\u6709\u8005\u7684\u8eab\u4efd. \u5178\u578b\u7684\u6587\u4ef6\u662fpasswd. \u5982\u679c\u4e00\u822c\u7528\u6237\u6267\u884c\u8be5\u6587\u4ef6, \u5219\u5728\u6267\u884c\u8fc7\u7a0b\u4e2d, \u8be5\u6587\u4ef6\u53ef\u4ee5\u83b7\u5f97root\u6743\u9650, \u4ece\u800c\u53ef\u4ee5\u66f4\u6539\u7528\u6237\u7684\u5bc6\u7801.<\/p>\n
ls -al \/usr\/bin\/passwd\r\n-rwsr-xr-x 1 pythontab pythontab 32988 2018-03-16 14:25 \/usr\/bin\/passwd\r\n<\/pre>\n\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5b57\u7b26\u6a21\u5f0f\u8bbe\u7f6es\u6743\u9650\uff1achmod a+s filename\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u7edd\u5bf9\u6a21\u5f0f\u8fdb\u884c\u8bbe\u7f6e\uff1a<\/p>\n
\u8bbe\u7f6es u i d\uff1a\u5c06\u76f8\u5e94\u7684\u6743\u9650\u4f4d\u4e4b\u524d\u7684\u90a3\u4e00\u4f4d\u8bbe\u7f6e\u4e3a4\uff1b<\/p>\n
\u8bbe\u7f6eg u i d\uff1a\u5c06\u76f8\u5e94\u7684\u6743\u9650\u4f4d\u4e4b\u524d\u7684\u90a3\u4e00\u4f4d\u8bbe\u7f6e\u4e3a2\uff1b<\/p>\n
\u4e24\u8005\u90fd\u7f6e\u4f4d\uff1a\u5c06\u76f8\u5e94\u7684\u6743\u9650\u4f4d\u4e4b\u524d\u7684\u90a3\u4e00\u4f4d\u8bbe\u7f6e\u4e3a4+2=6\u3002<\/p>\n
\u6ce8\u610f\uff1a\u5728\u8bbe\u7f6es\u6743\u9650\u65f6\u6587\u4ef6\u5c5e\u4e3b\u3001\u5c5e\u7ec4\u5fc5\u987b\u5148\u8bbe\u7f6e\u76f8\u5e94\u7684x\u6743\u9650\uff0c\u5426\u5219s\u6743\u9650\u5e76\u4e0d\u80fd\u6b63\u771f\u751f\u6548\uff08c h m o d\u547d\u4ee4\u4e0d\u8fdb\u884c\u5fc5\u8981\u7684\u5b8c\u6574\u6027\u68c0\u67e5\uff0c\u5373\u4f7f\u4e0d\u8bbe\u7f6ex\u6743\u9650\u5c31\u8bbe\u7f6es\u6743\u9650\uff0cchmod\u4e5f\u4e0d\u4f1a\u62a5\u9519\uff0c\u5f53\u6211\u4eecls -l\u65f6\u770b\u5230rwS\uff0c\u5927\u5199S\u8bf4\u660es\u6743\u9650\u672a\u751f\u6548\uff09<\/p>\n
<\/p>\n
t\u6743\u9650<\/strong><\/span><\/div>\nt\u6743\u9650\uff1a\u8981\u5220\u9664\u4e00\u4e2a\u6587\u6863\uff0c\u60a8\u4e0d\u4e00\u5b9a\u8981\u6709\u8fd9\u4e2a\u6587\u6863\u7684\u5199\u6743\u9650\uff0c\u4f46\u60a8\u4e00\u5b9a\u8981\u6709\u8fd9\u4e2a\u6587\u6863\u7684\u4e0a\u7ea7\u76ee\u5f55\u7684\u5199\u6743\u9650\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u60a8\u5373\u4f7f\u6ca1\u6709\u4e00\u4e2a\u6587\u6863\u7684\u5199\u6743\u9650\uff0c\u4f46\u60a8\u6709\u8fd9\u4e2a\u6587\u6863\u7684\u4e0a\u7ea7\u76ee\u5f55\u7684\u5199\u6743\u9650\uff0c\u60a8 \u4e5f\u80fd\u591f\u628a\u8fd9\u4e2a\u6587\u6863\u7ed9\u5220\u9664\uff0c\u800c\u5047\u5982\u6ca1\u6709\u4e00\u4e2a\u76ee\u5f55\u7684\u5199\u6743\u9650\uff0c\u4e5f\u5c31\u4e0d\u80fd\u5728\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u521b\u5efa\u6587\u6863\u3002<\/p>\n
\u600e\u6837\u624d\u80fd\u4f7f\u4e00\u4e2a\u76ee\u5f55\u65e2\u80fd\u591f\u8ba9\u4efb\u4f55\u7528\u6237\u5199\u5165\u6587\u6863\uff0c\u53c8\u4e0d\u8ba9\u7528\u6237\u5220\u9664\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u4ed6\u4eba\u7684\u6587\u6863\uff0ct\u6743\u9650\u5c31\u662f\u80fd\u8d77\u5230\u8fd9\u4e2a\u4f5c\u7528\u3002t\u6743\u9650\u4e00\u822c\u53ea\u7528\u5728\u76ee\u5f55\u4e0a\uff0c\u7528\u5728\u6587\u6863\u4e0a\u8d77\u4e0d\u5230\u4ec0\u4e48\u4f5c\u7528\u3002<\/p>\n
\u5728\u4e00\u4e2a\u76ee\u5f55\u4e0a\u8bbe\u4e86t\u6743\u9650\u4f4d\u540e\uff0c\uff08\u5982\/home\uff0c\u6743\u9650\u4e3a1777)\u4efb\u4f55\u7684\u7528\u6237\u90fd\u80fd\u591f\u5728\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u521b\u5efa\u6587\u6863\uff0c\u4f46\u53ea\u80fd\u5220\u9664\u81ea\u5df1\u521b\u5efa\u7684\u6587\u6863(root\u9664\u5916)\uff0c\u8fd9\u5c31\u5bf9\u4efb\u4f55\u7528\u6237\u80fd\u5199\u7684\u76ee\u5f55\u4e0b\u7684\u7528\u6237\u6587\u6863 \u542f\u5230\u4e86\u4fdd\u62a4\u7684\u4f5c\u7528\u3002<\/p>\n
\u53ef\u4ee5\u901a\u8fc7chmod +t filename \u6765\u8bbe\u7f6et\u6743\u9650<\/p>\n
\n\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/www.pythontab.com\/html\/2018\/linuxkaiyuan_0316\/1260.html<\/a><\/p>\n