{"id":360,"date":"2023-07-21T14:55:19","date_gmt":"2023-07-21T06:55:19","guid":{"rendered":"http:\/\/blog.naspro.cc\/?p=360"},"modified":"2023-07-22T09:28:19","modified_gmt":"2023-07-22T01:28:19","slug":"ubuntu%e5%ae%89%e8%a3%85ssh%e6%9c%8d%e5%8a%a1%e8%af%a6%e7%bb%86%e8%bf%87%e7%a8%8b","status":"publish","type":"post","link":"http:\/\/blog.naspro.cc\/?p=360","title":{"rendered":"Ubuntu\u5b89\u88c5ssh\u670d\u52a1\u5f00\u542froot\u6743\u9650"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_73 counter-flat ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"http:\/\/blog.naspro.cc\/?p=360\/#%e5%ae%89%e8%a3%85ssh%e6%9c%8d%e5%8a%a1\" title=\"\u5b89\u88c5ssh\u670d\u52a1\">\u5b89\u88c5ssh\u670d\u52a1<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"http:\/\/blog.naspro.cc\/?p=360\/#ubuntu%e5%bc%80%e9%80%9aroot%e6%9d%83%e9%99%90\" title=\"Ubuntu\u5f00\u901aroot\u6743\u9650\">Ubuntu\u5f00\u901aroot\u6743\u9650<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"http:\/\/blog.naspro.cc\/?p=360\/#%e5%bc%80%e5%90%afroot%e6%9d%83%e9%99%90%e7%99%bb%e5%bd%95ssh\" title=\"\u5f00\u542froot\u6743\u9650\u767b\u5f55SSH\">\u5f00\u542froot\u6743\u9650\u767b\u5f55SSH<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"%e5%ae%89%e8%a3%85ssh%e6%9c%8d%e5%8a%a1\"><\/span>\u5b89\u88c5ssh\u670d\u52a1<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\/\/ \u66f4\u65b0\u73af\u5883<\/p>\n<pre class=\"prettyprint linenums\" ><code class=\"language-shell\">sudo apt-get update<\/code><\/pre>\n<p>\/\/\u5b89\u88c5SSH\u670d\u52a1<\/p>\n<pre class=\"prettyprint linenums\" ><code class=\"language-shell\">sudo apt-get install openssh-server<\/code><\/pre>\n<p>\/\/ \u542f\u52a8ssh\u670d\u52a1<\/p>\n<pre class=\"prettyprint linenums\" ><code class=\"language-shell\">sudo \/etc\/init.d\/ssh start<\/code><\/pre>\n<p>\u68c0\u67e5ssh\u670d\u52a1\u662f\u5426\u5f00\u542f\uff0c\u53ef\u4ee5\u770b\u51fa\u5df2\u7ecf\u5f00\u542f\u4e86ssh<\/p>\n<pre class=\"prettyprint linenums\" ><code class=\"language-shell\"> ps -e | grep ssh<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/blog.naspro.cc\/wp-content\/uploads\/2023\/07\/image-1689922342152.png\" alt=\"file\" \/><\/p>\n<p>\u6253\u5f00SSH\u5f00\u59cb\u8fde\u63a5<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/blog.naspro.cc\/wp-content\/uploads\/2023\/07\/image-1689922401519.png\" alt=\"file\" \/><br \/>\n\u8868\u793a\u5df2\u7ecf\u6210\u529f<\/p>\n<h3><span class=\"ez-toc-section\" id=\"ubuntu%e5%bc%80%e9%80%9aroot%e6%9d%83%e9%99%90\"><\/span>Ubuntu\u5f00\u901aroot\u6743\u9650<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"prettyprint linenums\" ><code class=\"language-shell\">sudo passwd root<\/code><\/pre>\n<ul>\n<li>\u8f93\u5165\u60a8\u7684\u7528\u6237\u5bc6\u7801\uff0c\u7136\u540e\u8f93\u5165\u65b0\u7684root\u5bc6\u7801\u3002<\/li>\n<li>\u60a8\u73b0\u5728\u53ef\u4ee5\u4f7f\u7528root\u7528\u6237\u767b\u5f55\u7cfb\u7edf\u3002<\/li>\n<\/ul>\n<p>\u5173\u95edroot\u7528\u6237<br \/>\n\u5982\u679c\u60a8\u4e0d\u518d\u9700\u8981root\u7528\u6237\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5173\u95ed\u5b83\uff1a<\/p>\n<pre class=\"prettyprint linenums\" ><code class=\"language-shell\">sudo passwd -l root<\/code><\/pre>\n<ul>\n<li>\u8f93\u5165\u60a8\u7684\u7528\u6237\u5bc6\u7801\u3002<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"%e5%bc%80%e5%90%afroot%e6%9d%83%e9%99%90%e7%99%bb%e5%bd%95ssh\"><\/span>\u5f00\u542froot\u6743\u9650\u767b\u5f55SSH<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u4fee\u6539\/etc\/ssh\/sshd_config\u6587\u4ef6<br \/>\n\u627e\u5230 #PermitRootLogin prohibit-password<br \/>\n\u5c06 prohibit-password\u6539\u4e3ayes\uff0c\u5e76\u53bb\u6389\u6ce8\u91ca\u7b26\u53f7#<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/blog.naspro.cc\/wp-content\/uploads\/2023\/07\/image-1689924230978.png\" alt=\"file\" \/><\/p>\n<p>\u53ef\u4ee5\u91c7\u7528<\/p>\n<pre class=\"prettyprint linenums\" ><code>vim \/etc\/ssh\/sshd_config<\/code><\/pre>\n<p>\u4fee\u6539\u5b8c ESC \u9000\u51fa<\/p>\n<pre class=\"prettyprint linenums\" ><code>\uff1awq <\/code><\/pre>\n<p>\u547d\u4ee4\u4fdd\u5b58<\/p>\n<p>\u91cd\u542fSSH\u670d\u52a1<\/p>\n<pre class=\"prettyprint linenums\" ><code>\/etc\/init.d\/ssh restart <\/code><\/pre>\n<p>\u5173\u4e8e\u4fee\u6539 Ubutun \u6e90\u7684\u65b9\u6cd5\uff1a<a href=\"https:\/\/zhuanlan.zhihu.com\/p\/572556340\">https:\/\/zhuanlan.zhihu.com\/p\/572556340<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5ssh\u670d\u52a1 \/\/ \u66f4\u65b0\u73af\u5883 sudo apt-get update \/\/\u5b89\u88c5SSH\u670d\u52a1 sudo apt-get install openssh-server \/\/ \u542f\u52a8ssh\u670d\u52a1 sudo \/etc\/init.d\/ssh start \u68c0\u67e5ssh\u670d\u52a1\u662f\u5426\u5f00\u542f\uff0c\u53ef\u4ee5\u770b\u51fa\u5df2\u7ecf\u5f00\u542f\u4e86ssh ps -e | grep ssh \u6253\u5f00SSH\u5f00\u59cb\u8fde\u63a5 \u8868\u793a\u5df2\u7ecf\u6210\u529f Ubuntu\u5f00\u901aroot\u6743\u9650 sudo p [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":362,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,3],"tags":[],"class_list":["post-360","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-internet"],"_links":{"self":[{"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/posts\/360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=360"}],"version-history":[{"count":0,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/posts\/360\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/media\/362"}],"wp:attachment":[{"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=360"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}