\u67e5\u770b\u7528\u6237\u5217\u8868\uff1acat \/etc\/passwd\r\n\u67e5\u770b\u7ec4\u5217\u8868\uff1acat \/etc\/group\r\n\u67e5\u770b\u5f53\u524d\u767b\u9646\u7528\u6237\uff1awho\r\n\u67e5\u770b\u7528\u6237\u767b\u9646\u5386\u53f2\u8bb0\u5f55\uff1alast<\/pre>\n\u4e00\u822c\u9700\u8981\u5220\u9664\u7cfb\u7edf\u9ed8\u8ba4\u7684\u4e0d\u5fc5\u8981\u7684\u7528\u6237\u548c\u7ec4\uff0c\u907f\u514d\u88ab\u522b\u4eba\u7528\u6765\u7206\u7834\uff1a<\/p>\n
userdel sync\r\nuserdel shutdown\r\n# \u9700\u8981\u5220\u9664\u7684\u591a\u4f59\u7528\u6237\u5171\u6709\uff1async shutdown halt uucp operator games gopher\r\ngroupdel adm\r\ngroupdel games\r\n# \u9700\u8981\u5220\u9664\u7684\u591a\u4f59\u7528\u6237\u7ec4\u5171\u6709\uff1aadm lp games dip<\/pre>\nLinux\u4e2d\u7684\u5e10\u53f7\u548c\u53e3\u4ee4\u662f\u4f9d\u636e \/etc\/passwd \u3001\/etc\/shadow\u3001 \/etc\/group \u3001\/etc\/gshadow \u8fd9\u56db\u4e2a\u6587\u6863\u7684\uff0c\u6240\u4ee5\u9700\u8981\u66f4\u6539\u5176\u6743\u9650\u63d0\u9ad8\u5b89\u5168\u6027\uff1a<\/p>\n
chattr +i \/etc\/passwd\r\nchattr +i \/etc\/shadow\r\nchattr +i \/etc\/group\r\nchattr +i \/etc\/gshadow<\/pre>\n\u5982\u679c\u8fd8\u539f\uff0c\u628a +i \u6539\u6210 -i ,\u518d\u6267\u884c\u4e00\u4e0b\u4e0a\u9762\u56db\u6761\u547d\u4ee4\u3002<\/p>\n
\u6ce8\uff1ai\u5c5e\u6027\uff1a\u4e0d\u5141\u8bb8\u5bf9\u8fd9\u4e2a\u6587\u4ef6\u8fdb\u884c\u4fee\u6539\uff0c\u5220\u9664\u6216\u91cd\u547d\u540d\uff0c\u8bbe\u5b9a\u8fde\u7ed3\u4e5f\u65e0\u6cd5\u5199\u5165\u6216\u65b0\u589e\u6570\u636e\uff01\u53ea\u6709 root \u624d\u80fd\u8bbe\u5b9a\u8fd9\u4e2a\u5c5e\u6027\u3002<\/p>\n
\u521b\u5efa\u65b0\u7528\u6237<\/strong><\/span><\/div>\n\u521b\u5efa\u65b0\u7528\u6237\u547d\u4ee4\uff1aadduser username<\/span><\/p>\n\u66f4\u6539\u7528\u6237\u5bc6\u7801\u540d\uff1apasswd username<\/span><\/p>\n\u4e2a\u4eba\u7528\u6237\u7684\u6743\u9650\u53ea\u53ef\u4ee5\u5728\u672chome\u4e0b\u6709\u5b8c\u6574\u6743\u9650\uff0c\u5176\u4ed6\u76ee\u5f55\u8981\u770b\u522b\u4eba\u6388\u6743\u3002\u800c\u7ecf\u5e38\u9700\u8981root\u7528\u6237\u7684\u6743\u9650\uff0c\u8fd9\u65f6\u5019sudo\u53ef\u4ee5\u5316\u8eab\u4e3aroot\u6765\u64cd\u4f5c\u3002\u6211\u8bb0\u5f97\u6211\u66fe\u7ecfsudo\u521b\u5efa\u4e86\u6587\u4ef6\uff0c\u7136\u540e\u53d1\u73b0\u81ea\u5df1\u5e76\u6ca1\u6709\u8bfb\u5199\u6743\u9650\uff0c\u56e0\u4e3a\u67e5\u770b\u6743\u9650\u662froot\u521b\u5efa\u7684\u3002Linux\u7cfb\u7edf\u547d\u4ee4\u8fd8\u662f\u5f88\u91cd\u8981\u7684\uff0c120 \u4e2a\u300a \u5fc5\u77e5\u5fc5\u4f1a\u7684 Linux \u7cfb\u7edf\u5e38\u7528\u547d\u4ee4 \u300b\uff0c\u63a8\u8350\u5927\u5bb6\u770b\u770b\u3002<\/p>\n
sudoers \u53ea\u6709\u53ea\u8bfb\u7684\u6743\u9650\uff0c\u5982\u679c\u60f3\u8981\u4fee\u6539\u7684\u8bdd\uff0c\u9700\u8981\u5148\u6dfb\u52a0w\u6743\u9650\uff1achmod -v u+w \/etc\/sudoers<\/span> \u7136\u540e\u5c31\u53ef\u4ee5\u6dfb\u52a0\u5185\u5bb9\u4e86\uff0c\u5728\u4e0b\u9762\u7684\u4e00\u884c\u4e0b\u8ffd\u52a0\u65b0\u589e\u7684\u7528\u6237\uff1awq<\/span>\u4fdd\u5b58\u9000\u51fa\uff0c\u8fd9\u65f6\u5019\u8981\u8bb0\u5f97\u5c06\u5199\u6743\u9650\u6536\u56de\uff1achmod -v u-w \/etc\/sudoers<\/span><\/p>\n\u8d4b\u4e88root\u6743\u9650<\/strong><\/span><\/div>\n\u65b9\u6cd5\u4e00\uff1a\u4fee\u6539 \/etc\/sudoers<\/span> \u6587\u4ef6\uff0c\u627e\u5230\u4e0b\u9762\u4e00\u884c\uff0c\u628a\u524d\u9762\u7684\u6ce8\u91ca\uff08#\uff09\u53bb\u6389<\/p>\n## Allows people in group wheel to run all commands\r\n# \u53bb\u6389\u4e0b\u9762\u4e00\u53e5\u7684\u524d\u9762\u7684\u6ce8\u91ca #\r\n%wheel ALL=(ALL) ALL\r\n# \u7136\u540e\u4fee\u6539\u7528\u6237\uff0c\u4f7f\u5176\u5c5e\u4e8eroot\u7ec4\uff08wheel\uff09\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a\r\n# usermod -g root uusama<\/pre>\n\u4fee\u6539\u5b8c\u6bd5\uff0c\u73b0\u5728\u53ef\u4ee5\u7528uusama\u5e10\u53f7\u767b\u5f55\uff0c\u7136\u540e\u7528\u547d\u4ee4 su \u2013 \uff0c\u5373\u53ef\u83b7\u5f97root\u6743\u9650\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n
\u65b9\u6cd5\u4e8c\uff08\u63a8\u8350\uff09\uff1a\u4fee\u6539 \/etc\/sudoers <\/span>\u6587\u4ef6\uff0c\u627e\u5230\u4e0b\u9762\u4e00\u884c\uff0c\u5728root\u4e0b\u9762\u6dfb\u52a0\u4e00\u884c\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n## Allow root to run any commands anywhere\r\nroot ALL=(ALL) ALL\r\nuusama ALL=(ALL) ALL<\/pre>\n\u4fee\u6539\u5b8c\u6bd5\uff0c\u73b0\u5728\u53ef\u4ee5\u7528uusama\u5e10\u53f7\u767b\u5f55\uff0c\u7136\u540e\u7528\u547d\u4ee4 sudo -s \uff0c\u5373\u53ef\u83b7\u5f97root\u6743\u9650\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n
\u65b9\u6cd5\u4e09\uff1a\u4fee\u6539 \/etc\/passwd<\/span> \u6587\u4ef6\uff0c\u627e\u5230\u5982\u4e0b\u884c\uff0c\u628a\u7528\u6237ID\u4fee\u6539\u4e3a 0 \uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\nuusama:x:500:500:tommy:\/home\/uusama:\/bin\/bash\r\n# \u4fee\u6539\u540e\u5982\u4e0b\r\nuusama:x:0:500:tommy:\/home\/uusama:\/bin\/bash<\/pre>\n\u4fdd\u5b58\uff0c\u7528uusama\u8d26\u6237\u767b\u5f55\u540e\uff0c\u76f4\u63a5\u83b7\u53d6\u7684\u5c31\u662froot\u5e10\u53f7\u7684\u6743\u9650\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u597d\u4e0d\u5bb9\u6613\u4e70\u4e86\u670d\u52a1\u5668\uff0c\u5982\u679c\u56e0\u4e3a\u81ea\u5df1\u7684\u758f\u5ffd\uff0c\u88ab\u9ed1\u5ba2\u9ed1\u6389\u7684\u8bdd\uff0c\u90a3\u771f\u7684\u662f\u592a\u7cdf\u7cd5\u4e86\uff01\u4e0b\u9762\u544a\u8bc9\u4f60\u4e00\u4e9b\u7b80\u5355\u7684\u65b9\u6cd5\u63d0\u9ad8\u670d\u52a1\u5668\u7684 […]<\/p>\n","protected":false},"author":643,"featured_media":218691,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-218686","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\/218686","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\/643"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=218686"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/218686\/revisions"}],"predecessor-version":[{"id":218690,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/218686\/revisions\/218690"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/218691"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=218686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=218686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=218686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}