{"id":173788,"date":"2020-03-13T09:36:10","date_gmt":"2020-03-13T01:36:10","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=173788"},"modified":"2020-03-02T10:18:16","modified_gmt":"2020-03-02T02:18:16","slug":"delete-etc-passwd","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/delete-etc-passwd.html","title":{"rendered":"\u4e0d\u5c0f\u5fc3\u5220\u9664\/etc\/passwd\u6587\u4ef6\u600e\u4e48\u529e"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6211\u4eec\u5728\u64cd\u4f5cLInux\u7684\u65f6\u5019\uff0c\u5982\u679c\u4e0d\u5c0f\u5fc3\u5220\u6389\/etc\/passwd\u6587\u4ef6\uff0c\u6211\u4eec\u8be5\u600e\u6837\u89e3\u51b3\u5462\uff1f<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u5728Linux \u4e2d \/etc\/passwd\u6587\u4ef6\u4e2d\u6bcf\u4e2a\u7528\u6237\u90fd\u6709\u4e00\u4e2a\u5bf9\u5e94\u7684\u8bb0\u5f55\u884c\uff0c\u5b83\u8bb0\u5f55\u4e86\u8fd9\u4e2a\u7528\u6237\u7684\u4e00\u4e9b\u57fa\u672c\u5c5e\u6027\u3002\u7cfb\u7edf\u7ba1\u7406\u5458\u7ecf\u5e38\u4f1a\u63a5\u89e6\u5230\u8fd9\u4e2a\u6587\u4ef6\u7684\u4fee\u6539\u4ee5\u5b8c\u6210\u5bf9\u7528\u6237\u7684\u7ba1\u7406\u5de5\u4f5c\u3002<\/p>\n

\u6bd4\u5982\u8bf4\uff1a<\/p>\n

root❌0:0:root:\/root:\/bin\/bash<\/pre>\n

\u4ece\u4e0a\u9762\u7684\u4f8b\u5b50\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c\/etc\/passwd\u4e2d\u4e00\u884c\u8bb0\u5f55\u5bf9\u5e94\u7740\u4e00\u4e2a\u7528\u6237\uff0c\u6bcf\u884c\u8bb0\u5f55\u53c8\u88ab\u5192\u53f7(:)\u5206\u9694\u4e3a7\u4e2a\u5b57\u6bb5\uff0c\u5176\u683c\u5f0f\u548c\u5177\u4f53\u542b\u4e49\u5982\u4e0b\uff1a<\/p>\n

1.\u7528\u6237\u540d:\u53e3\u4ee4:\u7528\u6237\u6807\u8bc6\u53f7:\u7ec4\u6807\u8bc6\u53f7:\u6ce8\u91ca\u6027\u63cf\u8ff0:\u4e3b\u76ee\u5f55:\u767b\u5f55Shell<\/p>\n

2.\u7528\u6237\u540d(login_name):\u662f\u4ee3\u8868\u7528\u6237\u8d26\u53f7\u7684\u5b57\u7b26\u4e32\u3002\u901a\u5e38\u957f\u5ea6\u4e0d\u8d85\u8fc78\u4e2a\u5b57\u7b26\uff0c\u5e76\u4e14\u7531\u5927\u5c0f\u5199\u5b57\u6bcd\u548c\/\u6216\u6570\u5b57\u7ec4\u6210\u3002\u767b\u5f55\u540d\u4e2d\u4e0d\u80fd\u6709\u5192\u53f7(:)\u56e0\u4e3a\u5192\u53f7\u5728\u8fd9\u91cc\u662f\u5206\u9694\u7b26\u3002\u4e3a\u4e86\u517c\u5bb9\u8d77\u89c1\uff0c\u767b\u5f55\u540d\u4e2d\u6700\u597d\u4e0d\u8981\u5305\u542b\u70b9\u5b57\u7b26(.)\uff0c\u5e76\u4e14\u4e0d\u4f7f\u7528\u8fde\u5b57\u7b26(-)\u548c\u52a0\u53f7(+)\u6253\u5934\u3002<\/p>\n

3.\u53e3\u4ee4(passwd):\u4e00\u4e9b\u7cfb\u7edf\u4e2d\uff0c\u5b58\u653e\u7740\u52a0\u5bc6\u540e\u7684\u7528\u6237\u53e3\u4ee4\u5b57\u3002\u867d\u7136\u8fd9\u4e2a\u5b57\u6bb5\u5b58\u653e\u7684\u53ea\u662f\u7528\u6237\u53e3\u4ee4\u7684\u52a0\u5bc6\u4e32\uff0c\u4e0d\u662f\u660e\u6587\uff0c\u4f46\u662f\u7531\u4e8e\/etc\/passwd\u6587\u4ef6\u5bf9\u6240\u6709\u7528\u6237\u90fd\u53ef\u8bfb\uff0c\u6240\u4ee5\u8fd9\u4ecd\u662f\u4e00\u4e2a\u5b89\u5168\u9690\u60a3\u3002\u56e0\u6b64\uff0c\u73b0\u5728\u8bb8\u591aLinux\u7cfb\u7edf\uff08\u5982SVR4\uff09\u90fd\u4f7f\u7528\u4e86shadow\u6280\u672f\uff0c\u628a\u771f\u6b63\u7684\u52a0\u5bc6\u540e\u7684\u7528\u6237\u53e3\u4ee4\u5b57\u5b58\u653e\u5230\/etc\/shadow\u6587\u4ef6\u4e2d\uff0c\u800c\u5728\/etc\/passwd\u6587\u4ef6\u7684\u53e3\u4ee4\u5b57\u6bb5\u4e2d\u53ea\u5b58\u653e\u4e00\u4e2a\u7279\u6b8a\u7684\u5b57\u7b26\uff0c\u4f8b\u5982\u201cx\u201d\u6216\u8005\u201c*\u201d\u3002<\/p>\n

4.\u7528\u6237\u6807\u8bc6\u53f7(UID):\u662f\u4e00\u4e2a\u6574\u6570\uff0c\u7cfb\u7edf\u5185\u90e8\u7528\u5b83\u6765\u6807\u8bc6\u7528\u6237\u3002\u4e00\u822c\u60c5\u51b5\u4e0b\u5b83\u4e0e\u7528\u6237\u540d\u662f\u4e00\u4e00\u5bf9\u5e94\u7684\u3002\u5982\u679c\u51e0\u4e2a\u7528\u6237\u540d\u5bf9\u5e94\u7684\u7528\u6237\u6807\u8bc6\u53f7\u662f\u4e00\u6837\u7684\uff0c\u7cfb\u7edf\u5185\u90e8\u5c06\u628a\u5b83\u4eec\u89c6\u4e3a\u540c\u4e00\u4e2a\u7528\u6237\uff0c\u4f46\u662f\u5b83\u4eec\u53ef\u4ee5\u6709\u4e0d\u540c\u7684\u53e3\u4ee4\u3001\u4e0d\u540c\u7684\u4e3b\u76ee\u5f55\u4ee5\u53ca\u4e0d\u540c\u7684\u767b\u5f55Shell\u7b49\u3002\u53d6\u503c\u8303\u56f4\u662f0-65535\u30020\u662f\u8d85\u7ea7\u7528\u6237root\u7684\u6807\u8bc6\u53f7\uff0c1-99\u7531\u7cfb\u7edf\u4fdd\u7559\uff0c\u4f5c\u4e3a\u7ba1\u7406\u8d26\u53f7\uff0c\u666e\u901a\u7528\u6237\u7684\u6807\u8bc6\u53f7\u4ece100\u5f00\u59cb\u3002\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u8fd9\u4e2a\u754c\u9650\u662f500\u3002<\/p>\n

5.\u7ec4\u6807\u8bc6\u53f7(GID):\u5b57\u6bb5\u8bb0\u5f55\u7684\u662f\u7528\u6237\u6240\u5c5e\u7684\u7528\u6237\u7ec4\u3002\u5b83\u5bf9\u5e94\u7740\/etc\/group\u6587\u4ef6\u4e2d\u7684\u4e00\u6761\u8bb0\u5f55\u3002<\/p>\n

6.\u6ce8\u91ca\u6027\u63cf\u8ff0(users):\u5b57\u6bb5\u8bb0\u5f55\u7740\u7528\u6237\u7684\u4e00\u4e9b\u4e2a\u4eba\u60c5\u51b5\uff0c\u4f8b\u5982\u7528\u6237\u7684\u771f\u5b9e\u59d3\u540d\u3001\u7535\u8bdd\u3001\u5730\u5740\u7b49\uff0c\u8fd9\u4e2a\u5b57\u6bb5\u5e76\u6ca1\u6709\u4ec0\u4e48\u5b9e\u9645\u7684\u7528\u9014\u3002\u5728\u4e0d\u540c\u7684Linux\u7cfb\u7edf\u4e2d\uff0c\u8fd9\u4e2a\u5b57\u6bb5\u7684\u683c\u5f0f\u5e76\u6ca1\u6709\u7edf\u4e00\u3002\u5728\u8bb8\u591aLinux\u7cfb\u7edf\u4e2d\uff0c\u8fd9\u4e2a\u5b57\u6bb5\u5b58\u653e\u7684\u662f\u4e00\u6bb5\u4efb\u610f\u7684\u6ce8\u91ca\u6027\u63cf\u8ff0\u6587\u5b57\uff0c\u7528\u505afinger\u547d\u4ee4\u7684\u8f93\u51fa\u3002<\/p>\n

7.\u7528\u6237\u4e3b\u76ee\u5f55(home_directory):\u4e5f\u5c31\u662f\u7528\u6237\u7684\u8d77\u59cb\u5de5\u4f5c\u76ee\u5f55\uff0c\u5b83\u662f\u7528\u6237\u5728\u767b\u5f55\u5230\u7cfb\u7edf\u4e4b\u540e\u6240\u5904\u7684\u76ee\u5f55\u3002\u5728\u5927\u591a\u6570\u7cfb\u7edf\u4e2d\uff0c\u5404\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u90fd\u88ab\u7ec4\u7ec7\u5728\u540c\u4e00\u4e2a\u7279\u5b9a\u7684\u76ee\u5f55\u4e0b\uff0c\u800c\u7528\u6237\u4e3b\u76ee\u5f55\u7684\u540d\u79f0\u5c31\u662f\u8be5\u7528\u6237\u7684\u767b\u5f55\u540d\u3002\u5404\u7528\u6237\u5bf9\u81ea\u5df1\u7684\u4e3b\u76ee\u5f55\u6709\u8bfb\u3001\u5199\u3001\u6267\u884c\uff08\u641c\u7d22\uff09\u6743\u9650\uff0c\u5176\u4ed6\u7528\u6237\u5bf9\u6b64\u76ee\u5f55\u7684\u8bbf\u95ee\u6743\u9650\u5219\u6839\u636e\u5177\u4f53\u60c5\u51b5\u8bbe\u7f6e\u3002<\/p>\n

8.\u767b\u5f55Shell(Shell):\u7528\u6237\u767b\u5f55\u540e\uff0c\u8981\u542f\u52a8\u4e00\u4e2a\u8fdb\u7a0b\uff0c\u8d1f\u8d23\u5c06\u7528\u6237\u7684\u64cd\u4f5c\u4f20\u7ed9\u5185\u6838\uff0c\u8fd9\u4e2a\u8fdb\u7a0b\u662f\u7528\u6237\u767b\u5f55\u5230\u7cfb\u7edf\u540e\u8fd0\u884c\u7684\u547d\u4ee4\u89e3\u91ca\u5668\u6216\u67d0\u4e2a\u7279\u5b9a\u7684\u7a0b\u5e8f\uff0c\u5373Shell\u3002Shell\u662f\u7528\u6237\u4e0eLinux\u7cfb\u7edf\u4e4b\u95f4\u7684\u63a5\u53e3\u3002Linux\u7684Shell\u6709\u8bb8\u591a\u79cd\uff0c\u6bcf\u79cd\u90fd\u6709\u4e0d\u540c\u7684\u7279\u70b9\u3002\u5982\u679c\u4e0d\u6307\u5b9aShell\uff0c\u90a3\u4e48\u7cfb\u7edf\u4f7f\u7528sh\u4e3a\u9ed8\u8ba4\u7684\u767b\u5f55Shell\uff0c\u5373\u8fd9\u4e2a\u5b57\u6bb5\u7684\u503c\u4e3a\/bin\/sh\u3002<\/p>\n

\u7528\u6237\u7684\u767b\u5f55Shell\u53ef\u4ee5\u6307\u5b9a\u4e3a\u67d0\u4e2a\u7279\u5b9a\u7684\u7a0b\u5e8f\uff08\u6b64\u7a0b\u5e8f\u4e0d\u662f\u4e00\u4e2a\u547d\u4ee4\u89e3\u91ca\u5668\uff09\u3002\u5229\u7528\u8fd9\u4e00\u7279\u70b9\uff0c\u6211\u4eec\u53ef\u4ee5\u9650\u5236\u7528\u6237\u53ea\u80fd\u8fd0\u884c\u6307\u5b9a\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u5728\u8be5\u5e94\u7528\u7a0b\u5e8f\u8fd0\u884c\u7ed3\u675f\u540e\uff0c\u7528\u6237\u5c31\u81ea\u52a8\u9000\u51fa\u4e86\u7cfb\u7edf\u3002\u6709\u4e9bLinux\u7cfb\u7edf\u8981\u6c42\u53ea\u6709\u90a3\u4e9b\u5728\u7cfb\u7edf\u4e2d\u767b\u8bb0\u4e86\u7684\u7a0b\u5e8f\u624d\u80fd\u51fa\u73b0\u5728\u8fd9\u4e2a\u5b57\u6bb5\u4e2d\u3002<\/p>\n

\u90a3\u4e48\u6211\u4eec\u5728\u64cd\u4f5cLInux\u7684\u65f6\u5019\uff0c\u5982\u679c\u4e0d\u5c0f\u5fc3\u5220\u6389\/etc\/passwd\u6587\u4ef6\uff0c\u6211\u4eec\u8be5\u600e\u6837\u89e3\u51b3\u5462\uff1f<\/p>\n

\u4e00.\u5982\u679c\u5220\u6389\u4e4b\u540e\u672a\u91cd\u542f\u7cfb\u7edf\uff0c\u90a3\u4e48\u6211\u4eec\u53ea\u9700\u8981\u5c06\/etc\/passwd-\u8fd9\u4e2a\u5f15\u5b50\u6587\u4ef6\u62f7\u8d1d\u7ed9\/etc\/passwd\u5373\u53ef<\/p>\n

cp \/etc\/passwd- \/etc\/passwd<\/pre>\n

\u4e8c.\u5982\u679c\u6211\u4eec\u5728\u5220\u9664\u6587\u4ef6\u540e\u5173\u95ed\u4e86\u7cfb\u7edf\uff0c\u6253\u5f00\u7684\u65f6\u5019\u4f1a\u53d1\u73b0\u8fdb\u4e0d\u53bb<\/p>\n

\"\"<\/p>\n

\u90a3\u6211\u4eec\u8fd9\u6837\u89e3\u51b3:<\/strong><\/div>\n

1.\u5728GRUB\u5f15\u5bfc\u7684\u65f6\u5019\u6309e\u8fdb\u5165\u7f16\u8f91\u6a21\u5f0f\uff0clinux16\u90a3\u4e00\u884c\u7684ro \u4fee\u6539\u4e3arw rd.break<\/span><\/p>\n

2.ctrl+x\u6267\u884c<\/p>\n

3.\u8fdb\u5165\u5355\u7528\u6237\u6a21\u5f0f\u540e\u4fee\u6539\u6839\u8def\u5f84\uff0c\u5c06\u5f15\u5b50\u7a0b\u5e8f\u62f7\u8fdb\u6765<\/p>\n

chroot \/sysroot\r\n\r\ncp \/etc\/passwd- \/etc\/passwd<\/pre>\n

4.\u56e0\u4e3a\u62f7\u8d1d\u8fdb\u6765\u6587\u4ef6\u7684\u5b89\u5168\u4e0a\u4e0b\u6587\u548c\u5f53\u4eb2\u76ee\u5f55\u4e0d\u5339\u914d\uff0c\u90a3\u4e48\u6211\u4eec\u9700\u8981\u5173\u95edselinux<\/p>\n

vim \/etc\/sysconfig\/selinux\r\n\r\nselinux = disabled<\/pre>\n

5.\u4e24\u6b21exit\u9000\u51fa\u73b0\u5728\u7684\u6839\u5e76\u4e14\u91cd\u542f\u4e3b\u673a\uff0c\u6062\u590d\u6b63\u5e38<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5728Linux \u4e2d \/etc\/passwd\u6587\u4ef6\u4e2d\u6bcf\u4e2a\u7528\u6237\u90fd\u6709\u4e00\u4e2a\u5bf9\u5e94\u7684\u8bb0\u5f55\u884c\uff0c\u5b83\u8bb0\u5f55\u4e86\u8fd9\u4e2a\u7528\u6237\u7684\u4e00\u4e9b\u57fa\u672c\u5c5e\u6027\u3002\u7cfb […]<\/p>\n","protected":false},"author":310,"featured_media":173794,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-173788","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\/173788","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\/310"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=173788"}],"version-history":[{"count":7,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/173788\/revisions"}],"predecessor-version":[{"id":173927,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/173788\/revisions\/173927"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/173794"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=173788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=173788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=173788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}