{"id":274137,"date":"2023-06-05T04:05:05","date_gmt":"2023-06-04T20:05:05","guid":{"rendered":"https:\/\/lrxjmw.cn\/lqxjgsxqxhfj.html"},"modified":"2023-06-05T04:05:05","modified_gmt":"2023-06-04T20:05:05","slug":"lqxjgsxqxhfj","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lqxjgsxqxhfj.html","title":{"rendered":"Linux\u6743\u9650\u67b6\u6784\u601d\u60f33.1\u6743\u9650\u5212\u5206\u53ca\u4fee\u6539\u7528\u6237\u4e3b\u8981\u5206\u7ec4\u95ee\u9898"},"content":{"rendered":"

\u76ee\u5f55<\/p>\n

\u4e00\u3001\u6743\u9650\u5177\u8c61<\/p>\n

1.1\u7528\u6237\u548c\u7ec4<\/p>\n

\u4e8c\u3001\u548c\u6743\u9650\u6709\u5173\u7684\u51e0\u4e2a\u95ee\u9898<\/p>\n

2.1\u6587\u4ef6\u88ab\u521b\u5efa\u540e\uff0c\u521d\u59cb\u7684\u6743\u9650\u600e\u4e48\u8bbe\u7f6e\uff1f<\/p>\n

2.2\u516c\u5171\u6267\u884c\u6587\u4ef6\u7684\u6743\u9650<\/p>\n

2.3\u6267\u884c\u6587\u4ef6<\/p>\n

2.4\u53ef\u4e0d\u53ef\u4ee5\u591a\u4e2a\u7528\u6237\u90fd\u767b\u9646root\uff0c\u4e4b\u540e\u53ea\u7528root\u5e10\u6237\uff1f<\/p>\n

\u4e09\u3001\u6743\u9650\u6784\u67b6\u601d\u60f3<\/p>\n

3.1\u6743\u9650\u754c\u5b9a<\/p>\n

3.2\u5206\u7ea7\u4fdd\u62a4<\/p>\n

3.3\u7528\u6237\u5206\u7ec4\u6307\u4ee4<\/p>\n

3.3.1\u67e5\u770b<\/p>\n

3.3.2\u521b\u5efa\u7528\u6237<\/p>\n

3.3.3\u521b\u5efa\u5206\u7ec4<\/p>\n

3.3.4\u4e3a\u7528\u6237\u964d\u4f4e\u6b21\u7ea7\u5206\u7ec4<\/p>\n

3.3.5\u66f4\u6539\u7528\u6237\u4e3b\u8981\u5206\u7ec4<\/p>\n

\u56db\u3001\u95ee\u9898<\/p>\n

\u4e00\u3001\u6743\u9650\u5177\u8c61<\/p>\n

\u4e00\u4e2a\u5b8c\u6574\u7684\u6743\u9650\u7ba1\u7406\u4f53\u7cfb\uff0c\u8981\u6709\u5408\u7406\u7684\u5177\u8c61\u3002\u8fd9\u513f\u5c31\u5305\u62ec\u5bf9\u7528\u6237\u3001\u8fdb\u7a0b\u3001\u6587\u4ef6\u3001\u5185\u5b58\u3001\u7cfb\u7edf<\/a>\u8c03\u7528\u7b49\u5177\u8c61\u3002<\/p>\n

1.1\u7528\u6237\u548c\u7ec4<\/p>\n

Linux<\/a>\u662f\u4e00\u4e2a\u591a\u7528\u6237\u5e73\u53f0\uff0c\u5141\u8bb8\u591a\u4e2a\u7528\u6237\u540c\u65f6\u767b\u5165\u7cfb\u7edf\u5de5\u4f5c\u3002Linux\u5c06\u7528\u6237\u5177\u8c61\u6210\u4e86\u5e10\u6237\uff0c\u5e10\u6237\u53ef\u4ee5\u767b\u5165\u7cfb\u7edf\uff0c\u4f8b\u5982\u901a\u8fc7\u8f93\u5165\u767b\u5165\u540d+\u5bc6\u7801\u7684\u5f62\u5f0f\u767b\u9646\uff1b\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bc1\u4e66\u7684\u5f62\u5f0f\u767b\u9646\u3002<\/p>\n

\u4f46\u4e3a\u4e86\u4fbf\u6377\u5206\u914d\u6bcf\u4f4d\u7528\u6237\u7684\u6743\u9650\uff0cLinux\u8fd8\u652f\u6301\u7ec4\uff08Group\uff09\u5e10\u6237\u3002\u7ec4\u5e10\u6237\u662f\u591a\u4e2a\u5e10\u6237\u7684\u96c6\u5408\uff0c\u7ec4\u53ef\u4ee5\u4e3a\u6210\u5458\u4eec\u5206\u914d\u67d0\u4e00\u7c7b\u6743\u9650\u3002\u6bcf\u4f4d\u7528\u6237\u53ef\u4ee5\u5728\u591a\u4e2a\u7ec4\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u501f\u52a9\u7ec4\u7ed9\u7528\u6237\u5feb\u901f\u5206\u914d\u6743\u9650\u3002<\/p>\n

\u7ec4\u7684\u6982\u5ff5\u6709\u70b9\u50cf\u964c\u964c\u7fa4\u3002\u4e00\u4e2a\u7528\u6237\u53ef\u4ee5\u5728\u591a\u4e2a\u7fa4\u4e2d\u3002\u4f8b\u5982\u67d0\u4e2a\u7ec4\u4e2d\u5206\u914d\u4e8610\u4e2a\u76ee\u5f55\u7684\u6743\u9650\uff0c\u8fd9\u4e48\u65b0\u5efa\u7528\u6237\u7684\u65f6\u4faf\u53ef\u4ee5\u5c06\u8fd9\u4e2a\u7528\u6237\u964d\u4f4e\u5230\u8fd9\u4e2a\u7ec4\u4e2d\uff0c\u8fd9\u6837\u65b0\u589e\u7684\u7528\u6237\u5c31\u6bcb\u987b\u518d\u53bb\u4e00\u4e2a\u4e2a\u76ee\u5f55\u5206\u914d\u6743\u9650\u3002<\/p>\n

\u800c\u6bcf\u4e00\u4e2a\u964c\u964c\u7fa4\u90fd\u6709\u4e00\u4e2a\u7fa4\u4e3b\uff0cRoot\u5e10\u6237\u4e5f\u53eb\u4f5c\u8d85\u7ea7\u7ba1\u7406\u5458\uff0c\u5c31\u76f8\u5f53\u4e8e\u964c\u964c\u7fa4\u4e3b\uff0c\u5b83\u5bf9\u7cfb\u7edf\u6709\u7740\u5b8c\u5168\u7684\u638c\u63a7\u3002\u4e00\u4e2a\u8d85\u7ea7\u7ba1\u7406\u5458\u53ef\u4ee5\u4f7f\u7528\u7cfb\u7edf\u63d0\u4f9b\u7684\u5168\u90e8\u80fd\u529b\u3002<\/p>\n

\u636e\u6089\uff0cLinux\u8fd8\u5bf9\u6587\u4ef6\u8fdb\u884c\u4e86\u6743\u9650\u5177\u8c61\uff08\u6ce8\u610f\u76ee\u5f55\u4e5f\u662f\u4e00\u79cd\u6587\u4ef6\uff09\u3002Linux\u4e2d\u4e00\u4e2a\u6587\u4ef6\u53ef\u4ee5\u8bbe\u7f6e\u4e0b\u8fb93\u79cd\u6743\u9650\uff1a<\/p>\n

\u8bfb\u6743\u9650\uff08r\uff09\uff1a\u63a7\u5236\u8bfb\u53d6\u6587\u4ef6\u3002\u5199\u6743\u9650\uff08w\uff09\uff1a\u63a7\u5236\u5199\u5165\u6587\u4ef6\u3002\u6267\u884c\u6743\u9650\uff08x\uff09\uff1a\u63a7\u5236\u5c06\u6587\u4ef6\u6267\u884c\uff0c\u4f8b\u5982\u811a\u672c\u3001\u5e94\u7528\u7a0b\u5e8f\u7b49\u3002<\/p>\n

linux\u4fee\u6539\u73af\u5883\u53d8\u91cf \u7cfb\u7edf\u5d29\u4e86_linux \u7cfb\u7edf\u4fee\u6539\u65f6\u95f4_linux\u4fee\u6539\u73af\u5883\u53d8\u91cf \u7cfb\u7edf\u5d29\u4e86<\/p>\n

\u4e4b\u540e\u6bcf\u4f4d\u6587\u4ef6\u53c8\u53ef\u4ee5\u4ece3\u4e2a\u7ef4\u5ea6\u53bb\u914d\u7f6e\u4e0a\u8ff0\u76843\u79cd\u6743\u9650\uff1a<\/p>\n

\u7528\u6237\u7ef4\u5ea6\u3002\u6bcf\u4f4d\u6587\u4ef6\u53ef\u4ee5\u6240\u5c5e1\u4e2a\u7528\u6237linux\u542f\u52a8\u76d8\u5236\u4f5c\u5de5\u5177\uff0c\u7528\u6237\u7ef4\u5ea6\u914d\u7f6e\u7684rwx\u5728\u7528\u6237\u7ef4\u5ea6\u751f\u6548\uff1b\u7ec4\u7ef4\u5ea6\u3002\u6bcf\u4f4d\u6587\u4ef6\u53ef\u4ee5\u6240\u5c5e1\u4e2a\u5206\u7ec4\uff0c\u7ec4\u7ef4\u5ea6\u914d\u7f6e\u7684rwx\u5728\u7ec4\u7ef4\u5ea6\u751f\u6548\uff1b\u5168\u90e8\u7528\u6237\u7ef4\u5ea6\u3002\u8bbe\u7f6e\u5bf9\u6240\u6709\u7528\u6237\u7684\u6743\u9650\u3002<\/p>\n

linux\u4fee\u6539\u73af\u5883\u53d8\u91cf \u7cfb\u7edf\u5d29\u4e86_linux\u4fee\u6539\u73af\u5883\u53d8\u91cf \u7cfb\u7edf\u5d29\u4e86_linux \u7cfb\u7edf\u4fee\u6539\u65f6\u95f4<\/p>\n

\u200b<\/p>\n

\u56e0\u800cLinux\u4e2d\u6587\u4ef6\u7684\u6743\u9650\u53ef\u4ee5\u75289\u4e2a\u5b57\u7b26linux\u547d\u4ee4\u884c\u548cshell\u811a\u672c\u7f16\u7a0b\u5b9d\u5178\uff0c3\u7ec4rwx\u63cf\u8ff0\uff1a<\/p>\n

\u4e4b\u540e\u7528-\u4ee3\u8868\u6ca1\u6709\u6743\u9650\u3002\u4f8b\u5982rwxrwxrwx\u4ee3\u8868\u6240\u6709\u7ef4\u5ea6\u53ef\u4ee5\u8bfb\u5199\u6267\u884c\u3002rw--wxr-x\u4ee3\u8868\u7528\u6237\u7ef4\u5ea6\u4e0d\u53ef\u4ee5\u6267\u884c\uff0c\u7ec4\u7ef4\u5ea6\u4e0d\u53ef\u4ee5\u8bfb\u53d6\uff0c\u6240\u6709\u7528\u6237\u7ef4\u5ea6\u4e0d\u53ef\u4ee5\u5199\u5165\u3002<\/p>\n

\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u5047\u82e5\u7528ls-l\u67e5\u770b\u4e00\u4e2a\u6587\u4ef6\u7684\u6743\u9650\uff0c\u4f1a\u670910\u4e2a\u5b57\u7b26\uff0c\u8fd9\u662f\u7531\u4e8e\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4ee3\u8868\u7684\u662f\u6587\u4ef6\u7c7b\u578b\u3002\u6211\u6709\u7ba1\u7ebf\u6587\u4ef6\u3001\u76ee\u5f55\u6587\u4ef6\u3001\u94fe\u63a5\u6587\u4ef6\u7b49\u7b49\u3002<\/p>\n

-\u4ee3\u8868\u666e\u901a\u6587\u4ef6\u3001d\u4ee3\u8868\u76ee\u5f55\u3001p\u4ee3\u8868\u7ba1\u7ebf\u3002<\/p>\n

\u4e8c\u3001\u548c\u6743\u9650\u6709\u5173\u7684\u51e0\u4e2a\u95ee\u98982.1\u6587\u4ef6\u88ab\u521b\u5efa\u540e\uff0c\u521d\u59cb\u7684\u6743\u9650\u600e\u4e48\u8bbe\u7f6e\uff1f<\/p>\n

\u4e00\u4e2a\u6587\u4ef6\u521b\u5efa\u540e\uff0c\u6587\u4ef6\u7684\u6240\u5c5e\u7528\u6237\u4f1a\u88ab\u8bbe\u7f6e\u6210\u521b\u5efa\u6587\u4ef6\u7684\u7528\u6237\u3002\u8c01\u521b\u5efa\u8c01\u62e5\u6709\uff0c\u8fd9\u4e2a\u903b\u8f91\u5f88\u987a\u7406\u6210\u7ae0\u3002\u5e76\u4e14\u6587\u4ef6\u7684\u7ec4\u53c8\u662f\u600e\u6837\u5206\u914d\u7684\u5462\uff1f<\/p>\n

\u8fd9\u513fLinux\u60f3\u5230\u4e86\u4e00\u4e2a\u633a\u597d\u7684\u529e\u6cd5\uff0c\u5c31\u662f\u4e3a\u6bcf\u4f4d\u7528\u6237\u521b\u5efa\u4e00\u4e2a\u540c\u540d\u5206\u7ec4\u3002<\/p>\n

\u4f8b\u5982\u8bf4zhang\u8fd9\u4e2a\u5e10\u6237\u521b\u5efa\u65f6\uff0c\u4f1a\u521b\u5efa\u4e00\u4e2a\u53eb\u4f5czhang\u7684\u5206\u7ec4\u3002zhang\u767b\u9646\u4ee5\u540e\uff0c\u5de5\u4f5c\u5206\u7ec4\u90fd\u4f1a\u9ed8\u8ba4\u4f7f\u7528\u5b83\u7684\u540c\u540d\u5206\u7ec4zhang\u3002\u5047\u5982zhang\u60f3\u8981\u5207\u6362\u5de5\u4f5c\u5206\u7ec4\uff0c\u53ef\u4ee5\u4f7f\u7528newgrp\u6307\u4ee4\u5207\u6362\u5230\u53e6\u4e00\u4e2a\u5de5\u4f5c\u5206\u7ec4\u3002\u56e0\u800c\uff0c\u88ab\u521b\u5efa\u6587\u4ef6\u6240\u5c5e\u7684\u5206\u7ec4\u662f\u5f53\u65f6\u7528\u6237\u6240\u5728\u7684\u5de5\u4f5c\u5206\u7ec4\uff0c\u5047\u5982\u6ca1\u6709\u975e\u5e38\u8bbe\u7f6e\uff0c\u8fd9\u4e48\u5c31\u5c5e\u4e8e\u7528\u6237\u6240\u5728\u7684\u540c\u540d\u5206\u7ec4\u3002<\/p>\n

\u518d\u8bf4\u4e0b\u6587\u4ef6\u7684\u6743\u9650\u600e\u6837\uff1f\u6587\u4ef6\u88ab\u521b\u5efa\u540e\u7684\u6743\u9650\u4e00\u822c\u662f\uff1a<\/p>\n

\n

rw-rw-r--<\/code><\/pre>\n<\/p>\n

\u4e5f\u5c31\u662f\u7528\u6237\u3001\u7ec4\u7ef4\u5ea6\u4e0d\u53ef\u4ee5\u6267\u884c\uff0c\u6240\u6709\u7528\u6237\u53ef\u8bfb\u3002<\/p>\n

2.2\u516c\u5171\u6267\u884c\u6587\u4ef6\u7684\u6743\u9650<\/p>\n

\u540e\u9762\u63d0\u53ca\u8fc7\u53ef\u4ee5\u7528which\u6307\u4ee4\u67e5\u770bls\u6307\u4ee4\u6240\u5728\u7684\u76ee\u5f55\uff0c\u6211\u4eec\u53d1\u89c9\u5728\/usr\/bin\u4e2d\u3002\u4e4b\u540e\u7528ls-l\u67e5\u770bls\u7684\u6743\u9650\uff0c\u53ef\u4ee5\u770b\u89c1\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n

\n

~]# ls -l \/usr\/bin\/ls\n-rwxr-xr-x 1 root root 143368 Jun 10  2020 \/usr\/bin\/ls<\/code><\/pre>\n<\/p>\n

\u7b2c\u4e00\u4e2a-\u4ee3\u8868\u8fd9\u662f\u4e00\u4e2a\u666e\u901a\u6587\u4ef6\uff0c\u524d\u9762\u7684rwx\u4ee3\u8868\u7528\u6237\u7ef4\u5ea6\u53ef\u8bfb\u5199\u548c\u6267\u884c\uff1b\u7b2c\u4e8c\u4e2ar-x\u4ee3\u8868\u7ec4\u7ef4\u5ea6\u4e0d\u53ef\u4ee5\u5199\uff1b\u7b2c\u4e09\u4e2ar-x\u4ee3\u8868\u6240\u6709\u7528\u6237\u53ef\u4ee5\u8bfb\u548c\u6267\u884c\u3002\u524d\u9762\u7684\u4e24\u4e2aroot\uff0c\u7b2c\u4e00\u4e2a\u662f\u6240\u5c5e\u7528\u6237\uff0c\u7b2c\u4e8c\u4e2a\u662f\u6240\u5c5e\u5206\u7ec4\u3002<\/p>\n

\u5230\u8fd9\u513f\u4f60\u53ef\u80fd\u4f1a\u6709\u4e00\u4e2a\u7591\u60d1\uff1a\u5047\u5982\u4e00\u4e2a\u6587\u4ef6\u8bbe\u7f6e\u4e3a\u4e0d\u53ef\u8bfb\uff0c\u5e76\u4e14\u53ef\u4ee5\u6267\u884c\uff0c\u8fd9\u4e48\u7ed3\u679c\u4f1a\u5982\u4f55\uff1f<\/p>\n

\u7b54\u6848\u5176\u5b9e\u662f\u4e0d\u53ef\u4ee5\u6267\u884c\uff0c\u96be\u4ee5\u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9\u81ea\u7136\u4e0d\u53ef\u4ee5\u6267\u884c\u3002<\/p>\n

2.3\u6267\u884c\u6587\u4ef6<\/p>\n

\u5728Linux\u4e2d\uff0c\u5047\u5982\u4e00\u4e2a\u6587\u4ef6\u53ef\u4ee5\u88ab\u6267\u884c\uff0c\u5219\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7\u8f93\u5165\u6587\u4ef6\u8def\u5f84\uff08\u76f8\u5bf9\u8def\u5f84\u6216\u7edd\u5bf9\u8def\u5f84\uff09\u7684\u5f62\u5f0f\u6267\u884c\u3002\u5047\u5982\u60f3\u6267\u884c\u4e00\u4e2a\u4e0d\u53ef\u4ee5\u6267\u884c\u7684\u6587\u4ef6\uff0cLinux\u5219\u4f1a\u62a5\u9519\u3002<\/p>\n

\u5f53\u7528\u6237\u8f93\u5165\u4e00\u4e2a\u6587\u4ef6\u540d\uff0c\u5047\u5982\u6ca1\u6709\u6307\u5b9a\u5b8c\u6574\u8def\u5f84\uff0cLinux\u90fd\u4f1a\u5728\u4e00\u90e8\u4efd\u76ee\u5f55\u4e2d\u67e5\u627e\u8fd9\u4e2a\u6587\u4ef6\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7echo$PATH\u89c1\u5230Linux\u4f1a\u5728\u4ec0\u4e48\u76ee\u5f55\u4e2d\u67e5\u627e\u53ef\u6267\u884c\u6587\u4ef6\uff0cPATH\u662fLinux\u7684\u73af\u5883\u53d8\u91cf<\/p>\n

\n

 ~]# echo $PATH\n\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/usr\/local\/go\/bin:\/root\/bin\n<\/code><\/pre>\n<\/p>\n

2.4\u53ef\u4e0d\u53ef\u4ee5\u591a\u4e2a\u7528\u6237\u90fd\u767b\u9646root\uff0c\u4e4b\u540e\u53ea\u7528root\u5e10\u6237\uff1f<\/p>\n

\u6700\u540e\u4e00\u4e2a\u95ee\u9898\u662f\uff0c\u53ef\u4e0d\u53ef\u4ee5\u90fdroot\uff1f<\/p>\n

\u7b54\u6848\u5176\u5b9e\u662f\u4e0d\u884c\uff01\u4f46\u5374\u6211\u4eec\u5b9e\u9645\u751f\u4ea7\u4e2d\u5c31\u5982\u6b64\u4f7f\u7528\uff0croot\u6743\u9650\u771f\u7684\u592a\u5371\u9669,\u5e94\u5f53\u63d0\u5347linux\u6743\u9650\u4f7f\u7528\u7684\u610f\u8bc6\u3002<\/p>\n

\u5185\u6838\u63d0\u4f9b\u64cd\u4f5c\u786c\u4ef6\u3001\u78c1\u76d8\u3001\u5185\u5b58\u5206\u9875\u3001\u8fdb\u7a0b\u7b49\u6700\u6838\u5fc3\u7684\u80fd\u529b\uff0c\u5e76\u62e5\u6709\u76f4\u63a5\u64cd\u4f5c\u5168\u90e8\u663e\u5b58\u7684\u6743\u9650\uff0c\u56e0\u800c\u5185\u6838\u4e0d\u80fd\u628a\u81ea\u5df1\u7684\u5168\u90e8\u80fd\u529b\u90fd\u63d0\u4f9b\u7ed9\u7528\u6237\uff0c\u5e76\u4e14\u4e5f\u4e0d\u80fd\u5bb9\u8bb8\u7528\u6237\u901a\u8fc7shell\u6307\u4ee4\u8fdb\u884c\u7cfb\u7edf\u8c03\u7528\u3002Linux\u4e0b\u5185\u6838\u628a\u90e8\u4efd\u8fdb\u7a0b\u987b\u8981\u7684\u7cfb\u7edf\u8c03\u7528\u4ee5C\u8bed\u8a00API\u7684\u65b9\u5f0f\u63d0\u4f9b\u4e0b\u6765\u3002\u90e8\u4efd\u7cfb\u7edf\u8c03\u7528\u4f1a\u6709\u6743\u9650\u68c0\u6d4b\uff0c\u4f8b\u5982\u8bf4\u8bbe\u7f6e\u7cfb\u7edf\u65f6\u95f4\u7684\u7cfb\u7edf\u8c03\u7528\u3002<\/p>\n

\u4e09\u3001\u6743\u9650\u6784\u67b6\u601d\u60f3<\/p>\n

\u4f18\u79c0\u7684\u6743\u9650\u6784\u67b6\u4e3b\u8981\u76ee\u6807\u662f\u8ba9\u7cfb\u7edf\u5b89\u5168\u3001\u7a33\u5b9a\u4e14\u7528\u6237\u3001\u7a0b\u5e8f\u4e4b\u95f4\u4e92\u76f8\u63a3\u8098\u3001\u76f8\u4e92\u9694\u79bb\u3002\u8fd9\u8981\u6c42\u6743\u9650\u7cfb\u7edf\u4e2d\u7684\u6743\u9650\u754c\u5b9a\u8db3\u591f\u6e05\u6670\uff0c\u5206\u914d\u6743\u9650\u7684\u6210\u672c\u8db3\u591f\u4f4e\u3002<\/p>\n

\u4e3a\u6b64\uff0c\u4f18\u79c0\u7684\u6784\u67b6\uff0c\u5e94\u5f53\u9075\u5b88\u6700\u5c0f\u6743\u9650\u539f\u5219\uff08LeastPrivilege)\u3002\u6743\u9650\u8bbe\u8ba1\u987b\u8981\u4fdd\u8bc1\u7cfb\u7edf\u7684\u5b89\u5168\u548c\u7a33\u5b9a\u3002\u8bf8\u5982\uff1a\u6bcf\u4e00\u4e2a\u6210\u5458\u62e5\u6709\u7684\u6743\u9650\u5e94\u5f53\u8db3\u591f\u7684\u5c0f\uff0c\u6bcf\u4e00\u6bb5\u7279\u6743\u7a0b\u5e8f\u6267\u884c\u7684\u8fc7\u7a0b\u5e94\u5f53\u8db3\u591f\u7684\u77ed\u3002\u5bf9\u4e8e\u5b89\u5168\u7ea7\u522b\u8f83\u9ad8\u7684\u65f6\u4faf\uff0c\u8fd8\u987b\u8981\u6210\u5458\u6743\u9650\u76f8\u4e92\u5236\u8861\u3002\u8bf8\u5982\u91d1\u878d\u9886\u57df\u4e00\u822c\u767b\u9646\u7ebf\u4e0a\u6570\u636e\u5e93\u987b\u8981\u4e24\u6b21\u767b\u9646\uff0c\u4e5f\u5c31\u662f\u987b\u8981\u4e24\u4e2a\u5bc6\u7801\uff0c\u5206\u522b\u628a\u63e1\u5728\u4e24\u4e2a\u89d2\u8272\u624b\u4e2d\u3002\u8fd9\u6837\u5373\u4f7f\u4e00\u4e2a\u6210\u5458\u51fa\u4e86\u95ee\u9898\uff0c\u4e5f\u53ef\u4ee5\u4fdd\u8bc1\u6574\u4e2a\u7cfb\u7edf\u5b89\u5168\u3002<\/p>\n

\u540c\u6837\u7684\uff0c\u6bcf\u4f4d\u7a0b\u5e8f\u4e5f\u5e94\u5f53\u51cf\u8f7b\u6743\u9650\uff0c\u4f8b\u5982\u8bf4\u53ea\u62e5\u6709\u5c11\u91cf\u7684\u76ee\u5f55\u8bfb\u5199\u6743\u9650\uff0c\u53ea\u53ef\u4ee5\u8fdb\u884c\u5c11\u91cf\u7684\u7cfb\u7edf\u8c03\u7528\u3002<\/p>\n

3.1\u6743\u9650\u754c\u5b9a<\/p>\n

\u6743\u9650\u6784\u67b6\u601d\u60f3\u8fd8\u5e94\u9075\u5b88\u4e00\u4e2a\u539f\u5219\uff0c\u6743\u9650\u754c\u5b9a\u8fb9\u754c\u5e94\u5f53\u8db3\u591f\u6e05\u6670\uff0c\u5c3d\u91cf\u505a\u5230\u4e92\u76f8\u9694\u79bb\u3002Linux\u63d0\u4f9b\u4e86\u7528\u6237\u548c\u5206\u7ec4\u3002\u5176\u5b9eLinux\u6ca1\u6709\u903c\u8feb\u4f60\u600e\u4e48\u754c\u5b9a\u6743\u9650\uff0c\u8fd9\u662f\u4e3a\u4e86\u5e94\u5bf9\u66f4\u591a\u7684\u573a\u666f\u3002\u4e00\u822c\u6211\u4eec\u670d\u52a1\u5668\u4e0a\u91cd\u8981\u7684\u5e94\u7528\uff0c\u4f1a\u7531\u4e0d\u540c\u7684\u5e10\u6237\u6267\u884c\u3002\u4f8b\u5982\u8bf4Nginx\u3001Web\u670d\u52a1\u5668\u3001\u6570\u636e\u5e93\u4e0d\u4f1a\u6267\u884c\u5728\u4e00\u4e2a\u5e10\u6237\u4e0b\u3002\u5982\u4eca\u968f\u7740\u5bb9\u5668\u5316\u6280\u672f\u7684\u53d1\u5c55\uff0c\u6211\u4eec\u751a\u81f3\u5e0c\u671b\u6bcf\u4f4d\u5e94\u7528\u72ec\u4eab\u4e00\u4e2a\u865a\u62df\u7684\u7a7a\u95f4\uff0c\u5c31\u4f3c\u4e4e\u8fd0\u884c\u5728\u4e00\u4e2a\u5355\u72ec\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u4e00\u6837\uff0c\u8ba9\u5b83\u4eec\u76f8\u4e92\u4e0d\u7528\u5e72\u6270\u3002<\/p>\n

3.2\u5206\u7ea7\u4fdd\u62a4<\/p>\n

\u7531\u4e8e\u5185\u6838\u53ef\u4ee5\u76f4\u63a5\u64cd\u4f5c\u663e\u5b58\u548cCPU\uff0c\u56e0\u800c\u5341\u5206\u5371\u9669\u3002\u9a71\u52a8\u7a0b\u5e8f\u53ef\u4ee5\u76f4\u63a5\u63a7\u5236\u6444\u50cf\u5934\u3001\u663e\u793a\u5c4f\u7b49\u6838\u5fc3\u8bbe\u5907\uff0c\u4e5f\u987b\u8981\u91c7\u53d6\u5b89\u5168\u4e3e\u63aa\uff0c\u4f8b\u5982\u907f\u514d\u6076\u610f\u5e94\u7528\u5f00\u542f\u6444\u50cf\u5934\u7a83\u53d6\u9690\u79c1\u3002\u4e00\u822c\u64cd\u4f5c\u7cfb\u7edf\u90fd\u91c7\u53d6\u4e00\u79cd\u73af\u72b6\u7684\u4fdd\u62a4\u6a21\u5f0f\u3002<\/p>\n

linux \u7cfb\u7edf\u4fee\u6539\u65f6\u95f4_linux\u4fee\u6539\u73af\u5883\u53d8\u91cf \u7cfb\u7edf\u5d29\u4e86_linux\u4fee\u6539\u73af\u5883\u53d8\u91cf \u7cfb\u7edf\u5d29\u4e86<\/p>\n

\u200b<\/p>\n

\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u5185\u6838\u5728\u6700\u4e0a\u9762\uff0c\u4e5f\u5c31\u662fRing0\u3002\u5e94\u7528\u5728\u6700\u5916\u8fb9\u4e5f\u5c31\u662fRing3\u3002\u9a71\u52a8\u5728\u4e2d\u95f4\uff0c\u4e5f\u5c31\u662fRing1\u548cRing2\u3002\u5bf9\u4e8e\u76f8\u90bb\u7684\u4e24\u4e2aRing\uff0c\u5916\u5c42Ring\u4f1a\u62e5\u6709\u8f83\u9ad8\u7684\u6743\u9650\uff0c\u53ef\u4ee5\u6539\u53d8\u5185\u5c42\u7684Ring\uff1b\u800c\u5185\u5c42\u7684Ring\u60f3\u8981\u4f7f\u7528\u5916\u5c42Ring\u7684\u8d44\u6e90\u65f6\uff0c\u4f1a\u6709\u4e13\u95e8\u7684\u7a0b\u5e8f\uff08\u6216\u5219\u786c\u4ef6\uff09\u8fdb\u884c\u4fdd\u62a4\u3002<\/p>\n

\u4f8b\u5982\u8bf4\u4e00\u4e2aRing3\u7684\u5e94\u7528\u987b\u8981\u4f7f\u7528\u5185\u6838\uff0c\u5c31\u987b\u8981\u53d1\u9001\u4e00\u4e2a\u7cfb\u7edf\u8c03\u7528\u7ed9\u5185\u6838\u3002\u8fd9\u4e2a\u7cfb\u7edf\u8c03\u7528\u4f1a\u7531\u5185\u6838\u8fdb\u884c\u9a8c\u8bc1\uff0c\u4f8b\u5982\u9a8c\u8bc1\u7528\u6237\u6709\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\uff0c\u4ee5\u53ca\u8fd9\u4e2a\u884c\u4e3a\u662f\u5426\u5b89\u5168\u7b49\u7b49\u3002<\/p>\n

3.3\u7528\u6237\u5206\u7ec4\u6307\u4ee43.3.1\u67e5\u770b<\/p>\n

\u4f7f\u7528groups\u6307\u4ee4<\/p>\n

\u200b<\/p>\n

\u524d\u9762\u6307\u4ee4\u5217\u4e3e\u5f53\u524d\u7528\u6237\u7684\u6240\u6709\u5206\u7ec4\u3002\u7b2c\u4e00\u4e2a\u662f\u540c\u540d\u7684\u4e3b\u8981\u5206\u7ec4\uff0c\u524d\u9762\u4eceadm\u5f00\u59cb\u662f\u6b21\u7ea7\u5206\u7ec4\u3002<\/p>\n

\u6211\u5148\u7ed9\u4f60\u4ecb\u7ecd\u4e24\u4e2a\u5206\u7ec4\uff0c\u5176\u4ed6\u5206\u7ec4\u4f60\u53ef\u4ee5\u53bb\u67e5\u8d44\u6599\uff1a<\/p>\n

\u5047\u5982\u60f3\u67e5\u770b\u5f53\u524d\u7528\u6237\uff0c\u53ef\u4ee5\u4f7f\u7528id\u6307\u4ee4\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n

\n

~]# id\nuid=0(root) gid=0(root) groups=0(root)<\/code><\/pre>\n<\/p>\n

\u5047\u5982\u60f3\u67e5\u770b\u6240\u6709\u7684\u7528\u6237\uff0c\u53ef\u4ee5\u76f4\u63a5\u770b\/etc\/passwd\u3002<\/p>\n

\n

 ~]# more \/etc\/passwd\nroot:x:0:0:root:\/root:\/bin\/bash\nbin:x:1:1:bin:\/bin:\/sbin\/nologin\ndaemon:x:2:2:daemon:\/sbin:\/sbin\/nologin\nadm:x:3:4:adm:\/var\/adm:\/sbin\/nologin\nlp:x:4:7:lp:\/var\/spool\/lpd:\/sbin\/nologin\nsync:x:5:0:sync:\/sbin:\/bin\/sync\nshutdown:x:6:0:shutdown:\/sbin:\/sbin\/shutdown\nhalt:x:7:0:halt:\/sbin:\/sbin\/halt\nmail:x:8:12:mail:\/var\/spool\/mail:\/sbin\/nologin\noperator:x:11:0:operator:\/root:\/sbin\/nologin\ngames:x:12:100:games:\/usr\/games:\/sbin\/nologin\nftp:x:14:50:FTP User:\/var\/ftp:\/sbin\/nologin\n<\/code><\/pre>\n<\/p>\n

\/etc\/passwd\u8fd9\u4e2a\u6587\u4ef6\u50a8\u5b58\u4e86\u6240\u6709\u7684\u7528\u6237\u4fe1\u606f\uff0c\u5982\u53f3\u56fe\u6240\u793a\uff1a<\/p>\n

linux\u4fee\u6539\u73af\u5883\u53d8\u91cf \u7cfb\u7edf\u5d29\u4e86_linux \u7cfb\u7edf\u4fee\u6539\u65f6\u95f4_linux\u4fee\u6539\u73af\u5883\u53d8\u91cf \u7cfb\u7edf\u5d29\u4e86<\/p>\n

\u200b<\/p>\n

\n

sudo usermod -a -G sudo foo<\/code><\/pre>\n<\/p>\n

3.3.2\u521b\u5efa\u7528\u6237<\/p>\n

\n

sudo useradd foo<\/code><\/pre>\n<\/p>\n

sudo\u672c\u610f\u662fsuperuserdolinux\u4fee\u6539\u73af\u5883\u53d8\u91cf \u7cfb\u7edf\u5d29\u4e86<\/strong>\uff0c\u540e\u6765\u6f14\u5f04\u6210\u7528\u53e6\u4e00\u4e2a\u7528\u6237\u7684\u8eab\u5206\u53bb\u6267\u884c\u67d0\u4e2a\u6307\u4ee4\u3002\u82e5\u679c\u6ca1\u6709\u6307\u5b9a\u987b\u8981sudo\u7684\u7528\u6237\uff0c\u5982\u540c\u524d\u9762\u90a3\u6837\uff0c\u5c31\u662f\u4ee5\u8d85\u7ea7\u7ba1\u7406\u5458\u7684\u8eab\u5206\u3002\u7531\u4e8euseradd\u987b\u8981\u7ba1\u7406\u5458\u8eab\u5206\u3002\u8fd9\u53e5\u8bdd\u6267\u884c\u540e\uff0c\u4f1a\u8fdb\u884c\u6743\u9650\u63d0\u9ad8\uff0c\u5e76\u5f39\u51fa\u8f93\u5165\u7ba1\u7406\u5458\u5bc6\u7801\u7684\u8f93\u5165\u754c\u9762\u3002<\/p>\n

3.3.3\u521b\u5efa\u5206\u7ec4<\/p>\n

\n

sudo groupadd hello<\/code><\/pre>\n<\/p>\n

3.3.4\u4e3a\u7528\u6237\u964d\u4f4e\u6b21\u7ea7\u5206\u7ec4<\/p>\n

\u7ec4\u5206\u6210\u4e3b\u8981\u5206\u7ec4\uff08PrimaryGroup\uff09\u548c\u6b21\u7ea7\u5206\u7ec4\uff08SecondaryGroup\uff09\u3002\u4e3b\u8981\u5206\u7ec4\u53ea\u67091\u4e2a\uff0c\u6b21\u7ea7\u5206\u7ec4\u53ef\u4ee5\u6709\u591a\u4e2a\u3002\u5047\u5982\u60f3\u4e3a\u7528\u6237\u6dfb\u52a0\u4e00\u4e2a\u6b21\u7ea7\u5206\u7ec4\uff0c\u53ef\u4ee5\u7528usermod\u6307\u4ee4\u3002\u4e0b\u8fb9\u6307\u4ee4\u5c06\u7528\u6237foo\u6dfb\u52a0\u5230sudo\u5206\u7ec4\uff0c\u56e0\u800cfoo\u62e5\u6709\u4e86sudo\u7684\u6743\u9650\u3002<\/p>\n

\n

sudo usermod -a -G sudo foo<\/code><\/pre>\n<\/p>\n

-a\u4ee3\u8868append\uff0c-G\u4ee3\u8868\u4e00\u4e2a\u6b21\u7ea7\u5206\u7ec4\u7684\u6e05\u5355linux\u4fee\u6539\u73af\u5883\u53d8\u91cf \u7cfb\u7edf\u5d29\u4e86<\/strong>\uff0c\u6700\u540e\u4e00\u4e2afoo\u662f\u5e10\u6237\u540d\u3002<\/p>\n

3.3.5\u66f4\u6539\u7528\u6237\u4e3b\u8981\u5206\u7ec4<\/p>\n

\n

sudo usermod -g somegroup foo<\/code><\/pre>\n<\/p>\n

\u56db\u3001\u95ee\u9898<\/p>\n

1\u3001\u4e3a\u4ec0\u4e48\u4e0d\u7528root\u5e10\u6237\u6267\u884c\u7a0b\u5e8f\uff1f<\/p>\n

\u4e3e\u4e2a\u53cd\u4f8b\uff0c\u4f60\u6709\u4e00\u4e2aMysql\u8fdb\u7a0b\u6267\u884c\u5728root\uff08\u6700\u5927\u6743\u9650\uff09\u5e10\u6237\u4e0a\uff0c\u5047\u5982\u6709\u9ed1\u5ba2\u653b\u5360\u4e86\u4f60\u7684Mysql\u670d\u52a1\uff0c\u83b7\u5f97\u4e86\u5728Mysql\u4e0a\u6267\u884cSql\u7684\u6743\u9650\uff0c\u8fd9\u4e48\uff0c\u4f60\u7684\u6574\u4e2a\u7cfb\u7edf\u5c31\u90fd\u66dd\u9732\u5728\u9ed1\u5ba2\u773c\u524d\u4e86\u3002\u8fd9\u4f1a\u9020\u6210\u6781\u5176\u4e25\u91cd\u7684\u540e\u679c\u3002<\/p>\n

\u9ed1\u5ba2\u53ef\u4ee5\u501f\u52a9Mysql\u7684CopyFromPrgram\u6307\u4ee4\u4e3a\u6240\u6b32\u4e3a\uff0c\u4f8b\u5982\u5148\u5907\u4efd\u4f60\u7684\u5173\u952e\u6587\u4ef6\uff0c\u4e4b\u540e\u518d\u5220\u6389\u5979\u4eec\uff0c\u5e76\u903c\u8feb\u4f60\u901a\u8fc7\u6307\u5b9a\u5e10\u6237\u6253\u6b3e\u3002\u5018\u82e5\u6267\u884c\u6700\u5c0f\u6743\u9650\u539f\u5219\uff0c\u8fd9\u4e48\u9ed1\u5ba2\u867d\u7136\u653b\u5360\u6211\u4eec\u7684Mysql\u670d\u52a1\uff0c\u4ed6\u4e5f\u53ea\u80fd\u83b7\u5f97\u6700\u5c0f\u7684\u6743\u9650\u3002\u5176\u5b9e\uff0c\u9ed1\u5ba2\u9886\u5230Mysql\u6743\u9650\u4e5f\u662f\u5341\u5206\u53ef\u6015\u7684\uff0c\u800c\u4e14\u76f8\u6bd4\u9886\u5230\u6240\u6709\u6743\u9650\uff0c\u8fd9\u4e2a\u635f\u5931\u5c31\u5c0f\u591a\u4e86\u3002<\/p>\n

2\u3001\u8bf7\u8be6\u8ff0Linux\u6743\u9650\u754c\u5b9a\u7684\u539f\u5219\uff1f<\/p>\n

Linux\u4f9d\u5faa\u6700\u5c0f\u6743\u9650\u539f\u5219\u3002\u6bcf\u4f4d\u7528\u6237\u628a\u63e1\u7684\u6743\u9650\u5e94\u5f53\u8db3\u591f\u5c0f\uff0c\u6bcf\u4f4d\u7ec4\u628a\u63e1\u7684\u6743\u9650\u4e5f\u8db3\u591f\u5c0f\u3002\u5b9e\u9645\u751f\u4ea7\u8fc7\u7a0b\u4e2d\uff0c\u6700\u597d\u7ba1\u7406\u5458\u6743\u9650\u53ef\u4ee5\u5206\u62c6\uff0c\u76f8\u4e92\u5236\u8861\u907f\u514d\u95ee\u9898\u3002\u6bcf\u4f4d\u5e94\u7528\u5e94\u8be5\u5c3d\u53ef\u80fd\u5c0f\u7684\u4f7f\u7528\u6743\u9650\u3002\u6700\u7406\u60f3\u7684\u662f\u6bcf\u4f4d\u5e94\u7528\u5355\u72ec\u5360\u7528\u4e00\u4e2a\u5bb9\u5668\uff08\u4f8b\u5982Docker\uff09\uff0c\u8fd9\u6837\u5c31\u4e0d\u5b58\u5728\u76f8\u4e92\u5f71\u54cd\u7684\u95ee\u9898\u3002\u867d\u7136\u5e94\u7528\u88ab\u653b\u5360\uff0c\u4e5f\u672a\u80fd\u653b\u514bDocker\u7684\u4fdd\u62a4\u5c42\u3002\u5c3d\u53ef\u80fd\u5c11\u7684root\u3002\u5047\u5982\u4e00\u4e2a\u7528\u6237\u987b\u8981root\u80fd\u529b\uff0c\u8fd9\u4e48\u5e94\u8be5\u8fdb\u884c\u6743\u9650\u5305\u56f4\u2014\u2014\u9a6c\u4e0a\u63d0\u9ad8\u6743\u9650\uff08\u4f8b\u5982sudo\uff09\uff0c\u5904\u7406\u540e\u9a6c\u4e0a\u91ca\u653e\u6743\u9650\u3002\u7cfb\u7edf\u5c42\u9762\u5b9e\u73b0\u6743\u9650\u5206\u7ea7\u4fdd\u62a4\uff0c\u5c06\u7cfb\u7edf\u7684\u6743\u9650\u5206\u6210\u4e00\u4e2a\u4e2aRing\uff0c\u5185\u5c42Ring\u8c03\u7528\u5916\u5c42Ring\u65f6\u987b\u8981\u5916\u5c42Ring\u8fdb\u884c\u6743\u9650\u6821\u51c6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u8fd9\u91cc\u5c31\u5305\u62ec\u5bf9\u7528\u6237\u3001\u8fdb\u7a0b\u3001\u6587\u4ef6\u3001\u5185\u5b58\u3001\u7cfb\u7edf\u8c03\u7528\u7b49\u62bd\u8c61\u3002\u6267\u884c\u6743\u9650\uff08x\uff09\uff1a\u63a7\u5236\u5c06\u6587\u4ef6\u6267\u884c\uff0c\u6bd4\u5982\u811a\u672c\u3001\u5e94\u7528\u7a0b\u5e8f\u7b49\u3002\u5185\u6838\u63d0\u4f9b\u64cd\u4f5c\u786c\u4ef6\u3001\u78c1\u76d8\u3001\u5185\u5b58\u5206\u9875\u3001\u8fdb\u7a0b\u7b49\u6700\u6838\u5fc3\u7684\u80fd\u529b\uff0c\u5e76\u62e5\u6709\u76f4\u63a5\u64cd\u4f5c\u5168\u90e8\u5185\u5b58\u7684\u6743\u9650\uff0c\u56e0\u6b64\u5185\u6838\u4e0d\u80fd\u628a\u81ea\u5df1\u7684\u5168\u90e8\u80fd\u529b\u90fd\u63d0\u4f9b\u7ed9\u7528\u6237\uff0c\u800c\u4e14\u4e5f\u4e0d\u80fd\u5141\u8bb8\u7528\u6237\u901a\u8fc7shell\u6307\u4ee4\u8fdb\u884c\u7cfb\u7edf\u8c03\u7528\u3002\u90e8\u5206\u7cfb\u7edf\u8c03\u7528\u4f1a\u6709\u6743\u9650\u68c0\u67e5\uff0c\u6bd4\u5982\u8bf4\u8bbe\u7f6e\u7cfb\u7edf\u65f6\u95f4\u7684\u7cfb\u7edf\u8c03\u7528\u3002<\/p>\n","protected":false},"author":1,"featured_media":274140,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-274137","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/274137","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=274137"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/274137\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/274140"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=274137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=274137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=274137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}