{"id":2040,"date":"2021-12-23T12:28:23","date_gmt":"2021-12-23T04:28:23","guid":{"rendered":"https:\/\/www.yusian.com\/blog\/?p=2040"},"modified":"2021-12-23T12:28:23","modified_gmt":"2021-12-23T04:28:23","slug":"%e4%ba%9a%e9%a9%ac%e9%80%8a%e5%85%8d%e8%b4%b9%e4%ba%91%e4%b8%bb%e6%9c%ba%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8root%e7%94%a8%e6%88%b7%e5%b9%b6%e9%80%9a%e8%bf%87%e5%af%86%e7%a0%81%e7%99%bb%e5%bd%95","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/centos\/2021\/12\/23\/1228232040.html","title":{"rendered":"\u4e9a\u9a6c\u900a\u514d\u8d39\u4e91\u4e3b\u673a\u5982\u4f55\u4f7f\u7528root\u7528\u6237\u5e76\u901a\u8fc7\u5bc6\u7801\u767b\u5f55"},"content":{"rendered":"<h3>\u80cc\u666f<\/h3>\n<p>\u4e9a\u9a6c\u900a\u4e91\u4e3b\u673a\u63d0\u4f9b\u4e00\u5e74\u4e2d\u6bcf\u6708750\u5c0f\u65f6\u7684\u514d\u8d39\u4f7f\u7528\u65f6\u95f4\uff0c\u57fa\u672c\u4e0a\u5c31\u662f\u767d\u5ad6\uff0c\u94fe\u63a5\uff1ahttps:\/\/aws.amazon.com\/cn\/ec2\/pricing\/ \uff0c\u4f46\u4e91\u4e3b\u673a\u7533\u8bf7\u4e0b\u6765\u7684\u65f6\u5019\u9ed8\u8ba4\u6307\u5b9a\u4e86\u7528\u8bc1\u4e66\u8ba4\u8bc1\u767b\u5f55\uff0c\u5e76\u4e14\u5206\u914d\u7684\u5e10\u53f7\u662fec2-user\uff0c\u8fd9\u4e2a\u5c31\u6709\u70b9\u4e0d\u4e60\u60ef\u4e86\uff0c\u5982\u4f55\u5207\u6362\u5230root\u7528\u6237\u5e76\u4e14\u901a\u8fc7ssh\u767b\u5f55\u8fd9\u624d\u65b9\u4fbf\uff01<\/p>\n<p>\u50cf\u963f\u91cc\u4e91\u6216\u817e\u8baf\u4e91\u90fd\u662f\u5728\u521b\u5efa\u5b9e\u4f8b\u7684\u8fc7\u7a0b\u5f53\u4e2d\u81ea\u5df1\u6307\u5b9a\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u6216\u8005\u521b\u5efa\u5b9e\u4f8b\u540e\u901a\u8fc7\u90ae\u4ef6\u53ca\u77ed\u4fe1\u7684\u65b9\u5f0f\u5c06\u521d\u59cb\u5316\u7684\u968f\u673a\u5bc6\u7801\u53d1\u9001\u7ed9\u7528\u6237\uff0c\u4e9a\u9a6c\u900a\u4ed6\u4e0d\u8fd9\u6837\uff0c\u4f46\u4fee\u6539\u8d77\u6765\u5176\u5b9e\u4e5f\u5f88\u7b80\u5355\uff0c\u6765\u5427~<\/p>\n<h3>\u64cd\u4f5c\u6b65\u9aa4<\/h3>\n<ul>\n<li>\u8bbe\u7f6eroot\u5e10\u53f7\u5bc6\u7801<\/li>\n<\/ul>\n<pre><code class=\"language-shell line-numbers\">[root@server-5 ~]# passwd root\nChanging password for user root.\nNew password: \n<\/code><\/pre>\n<ul>\n<li>\u4fee\u6539ssh\u8ba4\u8bc1\u65b9\u5f0f<\/li>\n<\/ul>\n<pre><code class=\"language-shell line-numbers\">[root@server-5 ~]# vim \/etc\/ssh\/sshd_config \n<\/code><\/pre>\n<p>\u5728\u914d\u7f6e\u6587\u4ef6\u627e\u5230\u4ee5\u4e0b2\u5904\u5730\u65b9\u4fee\u6539\u5373\u53ef<\/p>\n<pre><code class=\"language-config line-numbers\"># \u4e0b\u9762\u8fd9\u53e5\u653e\u5f00\u6ce8\u91ca\uff0c\u8868\u660e\u5141\u8bb8root\u5e10\u53f7\u767b\u5f55\nPermitRootLogin yes\n# \u4e0b\u9762\u8fd9\u53e5\u8bbe\u7f6e\u4e3ayes\uff0c\u8868\u660e\u5141\u8bb8\u4f7f\u7528\u5bc6\u7801\u767b\u5f55\nPasswordAuthentication yes\n<\/code><\/pre>\n<ul>\n<li>\u522b\u5fd8\u4e86\u91cd\u542fssh\u670d\u52a1<\/li>\n<\/ul>\n<pre><code class=\"language-shell line-numbers\">[root@server-5 ~]# service sshd restart\nRedirecting to \/bin\/systemctl restart sshd.service\n[root@server-5 ~]# \n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f \u4e9a\u9a6c\u900a\u4e91\u4e3b\u673a\u63d0\u4f9b\u4e00\u5e74\u4e2d\u6bcf\u6708750\u5c0f\u65f6\u7684\u514d\u8d39\u4f7f\u7528\u65f6\u95f4\uff0c\u57fa\u672c\u4e0a\u5c31\u662f\u767d\u5ad6\uff0c\u94fe\u63a5\uff1ahttps:\/\/aws.amazon.com\/cn\/ec2\/pricing\/ \uff0c\u4f46\u4e91\u4e3b\u673a\u7533\u8bf7\u4e0b\u6765\u7684\u65f6\u5019\u9ed8\u8ba4\u6307\u5b9a\u4e86\u7528\u8bc1\u4e66\u8ba4\u8bc1\u767b\u5f55\uff0c\u5e76\u4e14\u5206\u914d\u7684\u5e10\u53f7\u662fec2-user\uff0c\u8fd9\u4e2a\u5c31\u6709\u70b9\u4e0d\u4e60\u60ef\u4e86\uff0c\u5982\u4f55\u5207\u6362\u5230root\u7528\u6237\u5e76\u4e14\u901a\u8fc7ssh\u767b\u5f55\u8fd9\u624d\u65b9\u4fbf\uff01 \u50cf\u963f\u91cc\u4e91\u6216\u817e\u8baf\u4e91\u90fd\u662f\u5728\u521b\u5efa\u5b9e\u4f8b\u7684\u8fc7\u7a0b\u5f53\u4e2d\u81ea\u5df1\u6307\u5b9a\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u6216\u8005\u521b\u5efa\u5b9e\u4f8b\u540e\u901a\u8fc7\u90ae\u4ef6\u53ca\u77ed\u4fe1\u7684\u65b9\u5f0f\u5c06\u521d\u59cb\u5316\u7684\u968f\u673a\u5bc6\u7801\u53d1\u9001\u7ed9\u7528\u6237\uff0c\u4e9a\u9a6c\u900a\u4ed6\u4e0d\u8fd9\u6837\uff0c\u4f46\u4fee\u6539\u8d77\u6765\u5176\u5b9e\u4e5f\u5f88\u7b80\u5355\uff0c\u6765\u5427~ \u64cd\u4f5c\u6b65\u9aa4 \u8bbe\u7f6eroot\u5e10\u53f7\u5bc6\u7801 [root@server-5 ~]# passwd root Changing password for user root. New password: \u4fee\u6539ssh\u8ba4\u8bc1\u65b9\u5f0f [root@server-5 ~]# vim \/etc\/ssh\/sshd_config \u5728\u914d\u7f6e\u6587\u4ef6\u627e\u5230\u4ee5\u4e0b2\u5904\u5730\u65b9\u4fee\u6539\u5373\u53ef # \u4e0b\u9762\u8fd9\u53e5\u653e\u5f00\u6ce8\u91ca\uff0c\u8868\u660e\u5141\u8bb8root\u5e10\u53f7\u767b\u5f55 PermitRootLogin yes # \u4e0b\u9762\u8fd9\u53e5\u8bbe\u7f6e\u4e3ayes\uff0c\u8868\u660e\u5141\u8bb8\u4f7f\u7528\u5bc6\u7801\u767b\u5f55 PasswordAuthentication yes \u522b\u5fd8\u4e86\u91cd\u542fssh\u670d\u52a1 [root@server-5 ~]# service sshd restart Redirecting to \/bin\/systemctl restart sshd.service [root@server-5 ~]#<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[374,375,376,118],"class_list":["post-2040","post","type-post","status-publish","format-standard","hentry","category-centos","tag-amazon","tag-ec2","tag-root","tag-ssh"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/2040","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=2040"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/2040\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=2040"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=2040"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=2040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}