{"id":62036,"date":"2025-04-29T13:16:05","date_gmt":"2025-04-29T05:16:05","guid":{"rendered":"https:\/\/fwq.ai\/blog\/62036\/"},"modified":"2025-04-29T13:16:05","modified_gmt":"2025-04-29T05:16:05","slug":"linux-%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%bf%85%e5%a4%87%e7%9a%84%e5%ae%89%e5%85%a8%e8%ae%be%e7%bd%ae%e5%bb%ba%e8%ae%ae%e6%94%b6%e8%97%8f%ef%bc%81%ef%bc%81%ef%bc%81-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/62036\/","title":{"rendered":"Linux \u670d\u52a1\u5668\u5fc5\u5907\u7684\u5b89\u5168\u8bbe\u7f6e,\u5efa\u8bae\u6536\u85cf\uff01\uff01\uff01"},"content":{"rendered":"<p>  <\/p>\n<p style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\"><span style=\"font-size: 17px\">\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<\/span><\/p>\n<p style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\"><span style=\"font-size: 17px\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/275\/013\/894789a71643e1e79fb1394d9550a349-0.jpg\" class=\"aligncenter\" title=\"Linux \u670d\u52a1\u5668\u5fc5\u5907\u7684\u5b89\u5168\u8bbe\u7f6e,\u5efa\u8bae\u6536\u85cf\uff01\uff01\uff01\u63d2\u56fe\" alt=\"Linux \u670d\u52a1\u5668\u5fc5\u5907\u7684\u5b89\u5168\u8bbe\u7f6e,\u5efa\u8bae\u6536\u85cf\uff01\uff01\uff01\u63d2\u56fe\" \/><\/span><\/p>\n<blockquote style=\"margin-top: 20px;margin-bottom: 20px;padding: 10px 10px 10px 20px;font-size: 0.9em;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;font-size: 16px;color: black;line-height: 26px\"><span style=\"font-size: 17px\">\u4e0b\u9762\u544a\u8bc9\u4f60\u4e00\u4e9b\u7b80\u5355\u7684\u65b9\u6cd5\u63d0\u9ad8\u670d\u52a1\u5668\u7684\u5b89\u5168\u7cfb\u6570\uff0c\u6211\u7684\u4e91\u670d\u52a1\u5668\u5c31\u662f\u8fd9\u4e48\u914d\u7f6e\u7684\uff0c\u867d\u7136\u6709\u4e9b\u9ebb\u70e6\uff0c\u4f46\u662f\u611f\u89c9\u5b89\u5fc3\u4e00\u4e9b\u3002<\/span><\/p>\n<\/blockquote>\n<h3><span style=\"font-size: 17px\">\u4fee\u6539 ssh \u767b\u9646\u914d\u7f6e<\/span><\/h3>\n<p style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\"><span style=\"font-size: 17px\">\u6253\u5f00 ssh \u914d\u7f6e\u6587\u4ef6<\/span><\/p>\n<pre>vim&nbsp;\/etc\/ssh\/sshd_config#\u4fee\u6539\u4ee5\u4e0b\u51e0\u9879Port&nbsp;10000#\u66f4\u6539SSH\u7aef\u53e3\uff0c\u6700\u597d\u6539\u4e3a10000\u4ee5\u4e0a\uff0c\u522b\u4eba\u626b\u63cf\u5230\u7aef\u53e3\u7684\u673a\u7387\u4e5f\u4f1a\u4e0b\u964d\u3002\u9632\u706b\u5899\u8981\u5f00\u653e\u914d\u7f6e\u597d\u7684\u7aef\u53e3\u53f7\uff0c\u5982\u679c\u662f\u963f\u91cc\u4e91\u670d\u52a1\u5668\uff0c\u4f60\u8fd8\u9700\u8981\u53bb\u963f\u91cc\u4e91\u540e\u53f0\u914d\u7f6e\u5f00\u53d1\u76f8\u5e94\u7684\u7aef\u53e3\u624d\u53ef\u4ee5\uff0c\u5426\u5219\u767b\u4e0d\u4e0a\u54e6\uff01\u5982\u679c\u4f60\u89c9\u5f97\u9ebb\u70e6\uff0c\u53ef\u4ee5\u4e0d\u7528\u6539&nbsp;Protocol&nbsp;2#\u7981\u7528\u7248\u672c1\u534f\u8bae,&nbsp;\u56e0\u4e3a\u5176\u8bbe\u8ba1\u7f3a\u9677,&nbsp;\u5f88\u5bb9\u6613\u4f7f\u5bc6\u7801\u88ab\u9ed1\u6389\u3002&nbsp;PermitRootLogin&nbsp;no#\u5c1d\u8bd5\u4efb\u4f55\u60c5\u51b5\u5148\u90fd\u4e0d\u5141\u8bb8&nbsp;Root&nbsp;\u767b\u5f55.&nbsp;\u751f\u6548\u540e\u6211\u4eec\u5c31\u4e0d\u80fd\u76f4\u63a5\u4ee5root\u7684\u65b9\u5f0f\u767b\u5f55\u4e86\uff0c\u6211\u4eec\u9700\u8981\u7528\u4e00\u4e2a\u666e\u901a\u7684\u5e10\u53f7\u6765\u767b\u5f55\uff0c\u7136\u540e\u7528su\u6765\u5207\u6362\u5230root\u5e10\u53f7\uff0c\u6ce8\u610f&nbsp;su\u548csu&nbsp;-&nbsp;\u662f\u6709\u4e00\u70b9\u5c0f\u5c0f\u533a\u522b\u7684\u3002\u5173\u952e\u5728\u4e8e\u73af\u5883\u53d8\u91cf\u7684\u4e0d\u540c\uff0csu&nbsp;-\u7684\u73af\u5883\u53d8\u91cf\u66f4\u5168\u9762\u3002&nbsp;PermitEmptyPasswords&nbsp;no\uff03\u7981\u6b62\u7a7a\u5bc6\u7801\u767b\u9646\u3002<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\"><span style=\"font-size: 17px\">\u6700\u540e\u9700\u8981\u91cd\u542f sshd \u670d\u52a1<\/span><\/p>\n<pre>service&nbsp;sshd&nbsp;restart<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<h3><span style=\"font-size: 17px\">\u7981\u6b62\u7cfb\u7edf\u54cd\u5e94\u4efb\u4f55\u4ece\u5916\u90e8 \/ \u5185\u90e8\u6765\u7684 ping \u8bf7\u6c42<\/span><\/h3>\n<pre>echo&nbsp;\u201c1\u201d&amp;gt;&nbsp;\/proc\/sys\/net\/ipv4\/icmp_echo_ignore_all<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\"><span style=\"font-size: 17px\">\u5176\u9ed8\u8ba4\u503c\u4e3a 0<\/span><\/p>\n<h3><span style=\"font-size: 17px\">\u7528\u6237\u7ba1\u7406<\/span><\/h3>\n<p style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\"><span style=\"font-size: 17px\">\u4e0b\u9762\u662f\u57fa\u672c\u7684\u7528\u6237\u7ba1\u7406\u547d\u4ee4<\/span><\/p>\n<pre>\u67e5\u770b\u7528\u6237\u5217\u8868\uff1acat&nbsp;\/etc\/passwd\u67e5\u770b\u7ec4\u5217\u8868\uff1acat&nbsp;\/etc\/group\u67e5\u770b\u5f53\u524d\u767b\u9646\u7528\u6237\uff1awho\u67e5\u770b\u7528\u6237\u767b\u9646\u5386\u53f2\u8bb0\u5f55\uff1alast<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<blockquote style=\"margin-top: 20px;margin-bottom: 20px;padding: 10px 10px 10px 20px;font-size: 0.9em;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;font-size: 16px;color: black;line-height: 26px\"><span style=\"font-size: 17px\">\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<\/span><\/p>\n<\/blockquote>\n<pre>userdel&nbsp;syncuserdel&nbsp;shutdown#&nbsp;\u9700\u8981\u5220\u9664\u7684\u591a\u4f59\u7528\u6237\u5171\u6709\uff1async&nbsp;shutdown&nbsp;halt&nbsp;uucp&nbsp;operator&nbsp;games&nbsp;gophergroupdel&nbsp;admgroupdel&nbsp;games#&nbsp;\u9700\u8981\u5220\u9664\u7684\u591a\u4f59\u7528\u6237\u7ec4\u5171\u6709\uff1aadm&nbsp;lp&nbsp;games&nbsp;dip<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<blockquote style=\"margin-top: 20px;margin-bottom: 20px;padding: 10px 10px 10px 20px;font-size: 0.9em;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;font-size: 16px;color: black;line-height: 26px\"><span style=\"font-size: 17px\">Linux \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<\/span><\/p>\n<\/blockquote>\n<pre>chattr&nbsp;+i&nbsp;\/etc\/passwdchattr&nbsp;+i&nbsp;\/etc\/shadowchattr&nbsp;+i&nbsp;\/etc\/groupchattr&nbsp;+i&nbsp;\/etc\/gshadow<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\"><span style=\"font-size: 17px\">\u5982\u679c\u8fd8\u539f\uff0c\u628a +i \u6539\u6210 -i , \u518d\u6267\u884c\u4e00\u4e0b\u4e0a\u9762\u56db\u6761\u547d\u4ee4\u3002\u53e6\u5916\uff0c\u641c\u7d22\u516c\u4f17\u53f7Linux\u4e2d\u6587\u793e\u533a\u540e\u53f0\u56de\u590d\u201c\u79c1\u623f\u83dc\u201d\uff0c\u83b7\u53d6\u4e00\u4efd\u60ca\u559c\u793c\u5305\u3002<\/span><\/p>\n<blockquote style=\"margin-top: 20px;margin-bottom: 20px;padding: 10px 10px 10px 20px;font-size: 0.9em;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;font-size: 16px;color: black;line-height: 26px\"><span style=\"font-size: 17px\">\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<\/span><\/p>\n<\/blockquote>\n<h3><span style=\"font-size: 17px\">\u521b\u5efa\u65b0\u7528\u6237<\/span><\/h3>\n<p style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\"><span style=\"font-size: 17px\">\u521b\u5efa\u65b0\u7528\u6237\u547d\u4ee4\uff1aadduser username<\/span><\/p>\n<p style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\"><span style=\"font-size: 17px\">\u66f4\u6539\u7528\u6237\u5bc6\u7801\u540d\uff1apasswd username<\/span><\/p>\n<blockquote style=\"margin-top: 20px;margin-bottom: 20px;padding: 10px 10px 10px 20px;font-size: 0.9em;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;font-size: 16px;color: black;line-height: 26px\"><span style=\"font-size: 17px\">\u4e2a\u4eba\u7528\u6237\u7684\u6743\u9650\u53ea\u53ef\u4ee5\u5728\u672c home \u4e0b\u6709\u5b8c\u6574\u6743\u9650\uff0c\u5176\u4ed6\u76ee\u5f55\u8981\u770b\u522b\u4eba\u6388\u6743\u3002\u800c\u7ecf\u5e38\u9700\u8981 root \u7528\u6237\u7684\u6743\u9650\uff0c\u8fd9\u65f6\u5019 sudo \u53ef\u4ee5\u5316\u8eab\u4e3a root \u6765\u64cd\u4f5c\u3002\u6211\u8bb0\u5f97\u6211\u66fe\u7ecf sudo \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\u662f root \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<\/span><\/p>\n<\/blockquote>\n<p style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\"><span style=\"font-size: 17px\">sudoers \u53ea\u6709\u53ea\u8bfb\u7684\u6743\u9650\uff0c\u5982\u679c\u60f3\u8981\u4fee\u6539\u7684\u8bdd\uff0c\u9700\u8981\u5148\u6dfb\u52a0 w \u6743\u9650\uff1achmod -v u+w \/etc\/sudoers \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 \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<h3><span style=\"font-size: 17px\">\u8d4b\u4e88 root \u6743\u9650<\/span><\/h3>\n<ul>\n<li>  <span>\u65b9\u6cd5\u4e00\uff1a\u4fee\u6539 \/etc\/sudoers \u6587\u4ef6\uff0c\u627e\u5230\u4e0b\u9762\u4e00\u884c\uff0c\u628a\u524d\u9762\u7684\u6ce8\u91ca\uff08#\uff09\u53bb\u6389<\/span> <\/li>\n<\/ul>\n<pre>##&nbsp;Allows&nbsp;people&nbsp;in&nbsp;group&nbsp;wheel&nbsp;to&nbsp;run&nbsp;all&nbsp;commands#&nbsp;\u53bb\u6389\u4e0b\u9762\u4e00\u53e5\u7684\u524d\u9762\u7684\u6ce8\u91ca&nbsp;#&nbsp;%wheel&nbsp;ALL=(ALL)&nbsp;ALL#&nbsp;\u7136\u540e\u4fee\u6539\u7528\u6237\uff0c\u4f7f\u5176\u5c5e\u4e8eroot\u7ec4\uff08wheel\uff09\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a#&nbsp;usermod&nbsp;-g&nbsp;root&nbsp;uusama<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<blockquote style=\"margin-top: 20px;margin-bottom: 20px;padding: 10px 10px 10px 20px;font-size: 0.9em;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;font-size: 16px;color: black;line-height: 26px\"><span style=\"font-size: 17px\">\u4fee\u6539\u5b8c\u6bd5\uff0c\u73b0\u5728\u53ef\u4ee5\u7528 uusama \u5e10\u53f7\u767b\u5f55\uff0c\u7136\u540e\u7528\u547d\u4ee4 su \u2013 \uff0c\u5373\u53ef\u83b7\u5f97 root \u6743\u9650\u8fdb\u884c\u64cd\u4f5c\u3002<\/span><\/p>\n<\/blockquote>\n<ul>\n<li>  <span>\u65b9\u6cd5\u4e8c\uff08\u63a8\u8350\uff09\uff1a\u4fee\u6539 \/etc\/sudoers \u6587\u4ef6\uff0c\u627e\u5230\u4e0b\u9762\u4e00\u884c\uff0c\u5728 root \u4e0b\u9762\u6dfb\u52a0\u4e00\u884c\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/span> <\/li>\n<\/ul>\n<pre>##&nbsp;Allow&nbsp;root&nbsp;to&nbsp;run&nbsp;any&nbsp;commands&nbsp;anywhereroot&nbsp;ALL=(ALL)&nbsp;ALLuusama&nbsp;ALL=(ALL)&nbsp;ALL<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p style=\"margin-bottom: 0px;padding-top: 8px;padding-bottom: 8px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\"><span style=\"font-size: 17px\">\u4fee\u6539\u5b8c\u6bd5\uff0c\u73b0\u5728\u53ef\u4ee5\u7528 uusama \u5e10\u53f7\u767b\u5f55\uff0c\u7136\u540e\u7528\u547d\u4ee4 sudo -s \uff0c\u5373\u53ef\u83b7\u5f97 root \u6743\u9650\u8fdb\u884c\u64cd\u4f5c\u3002<\/span><\/p>\n<ul>\n<li>  <span>\u65b9\u6cd5\u4e09\uff1a\u4fee\u6539 \/etc\/passwd \u6587\u4ef6\uff0c\u627e\u5230\u5982\u4e0b\u884c\uff0c\u628a\u7528\u6237 ID \u4fee\u6539\u4e3a 0 \uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/span> <\/li>\n<\/ul>\n<pre>uusama:x:500:500:tommy:\/home\/uusama:\/bin\/bash#&nbsp;\u4fee\u6539\u540e\u5982\u4e0buusama:x:0:500:tommy:\/home\/uusama:\/bin\/bash<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<blockquote style=\"margin-top: 20px;margin-bottom: 20px;padding: 10px 10px 10px 20px;font-size: 0.9em;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light,\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;font-size: 16px;color: black;line-height: 26px\"><span style=\"font-size: 17px\">\u4fdd\u5b58\uff0c\u7528 uusama \u8d26\u6237\u767b\u5f55\u540e\uff0c\u76f4\u63a5\u83b7\u53d6\u7684\u5c31\u662f root \u5e10\u53f7\u7684\u6743\u9650\u3002<\/span><\/p>\n<\/blockquote>\n<p>\u4ee5\u4e0a\u5c31\u662fLinux \u670d\u52a1\u5668\u5fc5\u5907\u7684\u5b89\u5168\u8bbe\u7f6e,\u5efa\u8bae\u6536\u85cf\uff01\uff01\uff01\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\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\u5b89\u5168\u7cfb\u6570\uff0c\u6211\u7684\u4e91\u670d\u52a1\u5668\u5c31\u662f\u8fd9\u4e48\u914d\u7f6e\u7684\uff0c\u867d\u7136\u6709\u4e9b\u9ebb\u70e6\uff0c\u4f46\u662f\u611f\u89c9\u5b89\u5fc3\u4e00\u4e9b\u3002 \u4fee\u6539 ssh \u767b\u9646\u914d\u7f6e \u6253\u5f00 ssh \u914d\u7f6e\u6587\u4ef6 vim&nbsp;\/etc\/ssh\/sshd_config#\u4fee\u6539\u4ee5\u4e0b\u51e0\u9879Port&nbsp;10000#\u66f4\u6539SSH\u7aef\u53e3\uff0c\u6700\u597d\u6539\u4e3a10000\u4ee5\u4e0a\uff0c\u522b\u4eba\u626b\u63cf\u5230\u7aef\u53e3\u7684\u673a\u7387\u4e5f\u4f1a\u4e0b\u964d\u3002\u9632\u706b\u5899\u8981\u5f00\u653e\u914d\u7f6e\u597d\u7684\u7aef\u53e3\u53f7\uff0c\u5982\u679c\u662f\u963f\u91cc\u4e91\u670d\u52a1\u5668\uff0c\u4f60\u8fd8\u9700\u8981\u53bb\u963f\u91cc\u4e91\u540e\u53f0\u914d\u7f6e\u5f00\u53d1\u76f8\u5e94\u7684\u7aef\u53e3\u624d\u53ef\u4ee5\uff0c\u5426\u5219\u767b\u4e0d\u4e0a\u54e6\uff01\u5982\u679c\u4f60\u89c9\u5f97\u9ebb\u70e6\uff0c\u53ef\u4ee5\u4e0d\u7528\u6539&nbsp;Protocol&nbsp;2#\u7981\u7528\u7248\u672c1\u534f\u8bae,&nbsp;\u56e0\u4e3a\u5176\u8bbe\u8ba1\u7f3a\u9677,&nbsp;\u5f88\u5bb9\u6613\u4f7f\u5bc6\u7801\u88ab\u9ed1\u6389\u3002&nbsp;PermitRootLogin&nbsp;no#\u5c1d\u8bd5\u4efb\u4f55\u60c5\u51b5\u5148\u90fd\u4e0d\u5141\u8bb8&nbsp;Root&nbsp;\u767b\u5f55.&nbsp;\u751f\u6548\u540e\u6211\u4eec\u5c31\u4e0d\u80fd\u76f4\u63a5\u4ee5root\u7684\u65b9\u5f0f\u767b\u5f55\u4e86\uff0c\u6211\u4eec\u9700\u8981\u7528\u4e00\u4e2a\u666e\u901a\u7684\u5e10\u53f7\u6765\u767b\u5f55\uff0c\u7136\u540e\u7528su\u6765\u5207\u6362\u5230root\u5e10\u53f7\uff0c\u6ce8\u610f&nbsp;su\u548csu&nbsp;&#8211;&nbsp;\u662f\u6709\u4e00\u70b9\u5c0f\u5c0f\u533a\u522b\u7684\u3002\u5173\u952e\u5728\u4e8e\u73af\u5883\u53d8\u91cf\u7684\u4e0d\u540c\uff0csu&nbsp;-\u7684\u73af\u5883\u53d8\u91cf\u66f4\u5168\u9762\u3002&nbsp;PermitEmptyPasswords&nbsp;no\uff03\u7981\u6b62\u7a7a\u5bc6\u7801\u767b\u9646\u3002 \u767b\u5f55\u540e\u590d\u5236 \u6700\u540e\u9700\u8981\u91cd\u542f sshd \u670d\u52a1 service&nbsp;sshd&nbsp;restart \u767b\u5f55\u540e\u590d\u5236 \u7981\u6b62\u7cfb\u7edf\u54cd\u5e94\u4efb\u4f55\u4ece\u5916\u90e8 \/ \u5185\u90e8\u6765\u7684 ping \u8bf7\u6c42 echo&nbsp;\u201c1\u201d&amp;gt;&nbsp;\/proc\/sys\/net\/ipv4\/icmp_echo_ignore_all \u767b\u5f55\u540e\u590d\u5236 \u5176\u9ed8\u8ba4\u503c\u4e3a 0 \u7528\u6237\u7ba1\u7406 \u4e0b\u9762\u662f\u57fa\u672c\u7684\u7528\u6237\u7ba1\u7406\u547d\u4ee4 \u67e5\u770b\u7528\u6237\u5217\u8868\uff1acat&nbsp;\/etc\/passwd\u67e5\u770b\u7ec4\u5217\u8868\uff1acat&nbsp;\/etc\/group\u67e5\u770b\u5f53\u524d\u767b\u9646\u7528\u6237\uff1awho\u67e5\u770b\u7528\u6237\u767b\u9646\u5386\u53f2\u8bb0\u5f55\uff1alast \u767b\u5f55\u540e\u590d\u5236 \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 userdel&nbsp;syncuserdel&nbsp;shutdown#&nbsp;\u9700\u8981\u5220\u9664\u7684\u591a\u4f59\u7528\u6237\u5171\u6709\uff1async&nbsp;shutdown&nbsp;halt&nbsp;uucp&nbsp;operator&nbsp;games&nbsp;gophergroupdel&nbsp;admgroupdel&nbsp;games#&nbsp;\u9700\u8981\u5220\u9664\u7684\u591a\u4f59\u7528\u6237\u7ec4\u5171\u6709\uff1aadm&nbsp;lp&nbsp;games&nbsp;dip \u767b\u5f55\u540e\u590d\u5236 Linux \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 chattr&nbsp;+i&nbsp;\/etc\/passwdchattr&nbsp;+i&nbsp;\/etc\/shadowchattr&nbsp;+i&nbsp;\/etc\/groupchattr&nbsp;+i&nbsp;\/etc\/gshadow \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u8fd8\u539f\uff0c\u628a +i \u6539\u6210 -i , \u518d\u6267\u884c\u4e00\u4e0b\u4e0a\u9762\u56db\u6761\u547d\u4ee4\u3002\u53e6\u5916\uff0c\u641c\u7d22\u516c\u4f17\u53f7Linux\u4e2d\u6587\u793e\u533a\u540e\u53f0\u56de\u590d\u201c\u79c1\u623f\u83dc\u201d\uff0c\u83b7\u53d6\u4e00\u4efd\u60ca\u559c\u793c\u5305\u3002 \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 \u521b\u5efa\u65b0\u7528\u6237 \u521b\u5efa\u65b0\u7528\u6237\u547d\u4ee4\uff1aadduser username \u66f4\u6539\u7528\u6237\u5bc6\u7801\u540d\uff1apasswd username [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-62036","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/62036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=62036"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/62036\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=62036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=62036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=62036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}