{"id":63469,"date":"2025-04-29T17:50:42","date_gmt":"2025-04-29T09:50:42","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63469\/"},"modified":"2025-04-29T17:50:42","modified_gmt":"2025-04-29T09:50:42","slug":"centos7%e6%80%8e%e4%b9%88%e5%bc%80%e5%90%afroot%e6%9d%83%e9%99%90-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63469\/","title":{"rendered":"centos7\u600e\u4e48\u5f00\u542froot\u6743\u9650"},"content":{"rendered":"<blockquote><p>\n  centos 7 \u9ed8\u8ba4\u7981\u7528 root \u6743\u9650\uff0c\u53ef\u6309\u4ee5\u4e0b\u6b65\u9aa4\u5f00\u542f\uff1a\u4e34\u65f6\u5f00\u542f\uff1a\u7ec8\u7aef\u8f93\u5165 &#8220;su root&#8221;\uff0c\u8f93\u5165 root \u5bc6\u7801\u3002\u6c38\u4e45\u5f00\u542f\uff1a\u7f16\u8f91 &#8220;\/etc\/ssh\/sshd_config&#8221;\uff0c\u5c06 &#8220;permitrootlogin no&#8221; \u66f4\u6539\u4e3a &#8220;yes&#8221;\uff0c\u91cd\u542f ssh \u670d\u52a1\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/07\/2024040720032414114.jpg\" class=\"aligncenter\" title=\"centos7\u600e\u4e48\u5f00\u542froot\u6743\u9650\u63d2\u56fe\" alt=\"centos7\u600e\u4e48\u5f00\u542froot\u6743\u9650\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5f00\u542f CentOS 7 \u4e2d\u7684 Root \u6743\u9650<\/strong><\/p>\n<p>CentOS 7 \u9ed8\u8ba4\u7981\u7528 root \u6743\u9650\uff0c\u4e3a\u4e86\u5b89\u5168\u539f\u56e0\u3002\u5982\u679c\u60a8\u9700\u8981\u4e34\u65f6\u6216\u6c38\u4e45\u5f00\u542f root \u6743\u9650\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>\u4e34\u65f6\u5f00\u542f root \u6743\u9650<\/strong><\/p>\n<ol>\n<li>\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/li>\n<\/ol>\n<pre>su root<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li>\u8f93\u5165 root \u5bc6\u7801\u3002<\/li>\n<li>\u5b8c\u6210\u540e\uff0c\u60a8\u5c06\u83b7\u5f97 root \u6743\u9650\uff0c\u547d\u4ee4\u63d0\u793a\u7b26\u4f1a\u53d8\u4e3a #\u3002<\/li>\n<li>\u5b8c\u6210\u4efb\u52a1\u540e\uff0c\u4f7f\u7528 exit \u547d\u4ee4\u9000\u51fa root \u6743\u9650\u3002<\/li>\n<\/ol>\n<p><strong>\u6c38\u4e45\u5f00\u542f root \u6743\u9650<\/strong><\/p>\n<ol>\n<li>\u7f16\u8f91 \/etc\/ssh\/sshd_config \u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<pre>vi \/etc\/ssh\/sshd_config<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li>\u627e\u5230\u4ee5\u4e0b\u884c\uff1a<\/li>\n<\/ol>\n<pre>PermitRootLogin no<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li>\u5c06 no \u66f4\u6539\u4e3a yes\u3002<\/li>\n<li>\u4fdd\u5b58\u5e76\u5173\u95ed\u6587\u4ef6\u3002<\/li>\n<li>\u91cd\u542f SSH \u670d\u52a1\uff1a<\/li>\n<\/ol>\n<pre>systemctl restart sshd<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u73b0\u5728\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 root \u7528\u6237\u540d\u548c\u5bc6\u7801\u901a\u8fc7 SSH \u8fde\u63a5\u5230\u7cfb\u7edf\u3002<strong>\u6ce8\u610f\uff1a<\/strong>\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5f3a\u70c8\u5efa\u8bae\u60a8\u4ec5\u5728\u9700\u8981\u65f6\u624d\u542f\u7528 root \u6743\u9650\uff0c\u5e76\u4e14\u5728\u5b8c\u6210\u540e\u5e94\u7981\u7528 root \u6743\u9650\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f7\u600e\u4e48\u5f00\u542froot\u6743\u9650\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>centos 7 \u9ed8\u8ba4\u7981\u7528 root \u6743\u9650\uff0c\u53ef\u6309\u4ee5\u4e0b\u6b65\u9aa4\u5f00\u542f\uff1a\u4e34\u65f6\u5f00\u542f\uff1a\u7ec8\u7aef\u8f93\u5165 &#8220;su root&#8221;\uff0c\u8f93\u5165 root \u5bc6\u7801\u3002\u6c38\u4e45\u5f00\u542f\uff1a\u7f16\u8f91 &#8220;\/etc\/ssh\/sshd_config&#8221;\uff0c\u5c06 &#8220;permitrootlogin no&#8221; \u66f4\u6539\u4e3a &#8220;yes&#8221;\uff0c\u91cd\u542f ssh \u670d\u52a1\u3002 \u5982\u4f55\u5f00\u542f CentOS 7 \u4e2d\u7684 Root \u6743\u9650 CentOS 7 \u9ed8\u8ba4\u7981\u7528 root \u6743\u9650\uff0c\u4e3a\u4e86\u5b89\u5168\u539f\u56e0\u3002\u5982\u679c\u60a8\u9700\u8981\u4e34\u65f6\u6216\u6c38\u4e45\u5f00\u542f root \u6743\u9650\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a \u4e34\u65f6\u5f00\u542f root \u6743\u9650 \u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a su root \u767b\u5f55\u540e\u590d\u5236 \u8f93\u5165 root \u5bc6\u7801\u3002 \u5b8c\u6210\u540e\uff0c\u60a8\u5c06\u83b7\u5f97 root \u6743\u9650\uff0c\u547d\u4ee4\u63d0\u793a\u7b26\u4f1a\u53d8\u4e3a #\u3002 \u5b8c\u6210\u4efb\u52a1\u540e\uff0c\u4f7f\u7528 exit \u547d\u4ee4\u9000\u51fa root \u6743\u9650\u3002 \u6c38\u4e45\u5f00\u542f root \u6743\u9650 \u7f16\u8f91 \/etc\/ssh\/sshd_config \u6587\u4ef6\uff1a vi [&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-63469","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63469","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=63469"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63469\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}