{"id":843,"date":"2021-12-20T09:07:00","date_gmt":"2021-12-20T01:07:00","guid":{"rendered":"http:\/\/www.langmanezhuang.com\/index.php\/2021\/12\/20\/centos-8-sshd-%e6%97%a0%e6%b3%95%e8%bf%9e%e6%8e%a5\/"},"modified":"2022-11-26T20:53:22","modified_gmt":"2022-11-26T12:53:22","slug":"centos-8-sshd-%e6%97%a0%e6%b3%95%e8%bf%9e%e6%8e%a5","status":"publish","type":"post","link":"http:\/\/blog.langmanezhuang.com\/index.php\/2021\/12\/20\/centos-8-sshd-%e6%97%a0%e6%b3%95%e8%bf%9e%e6%8e%a5\/","title":{"rendered":"centos 8 sshd \u65e0\u6cd5\u8fde\u63a5"},"content":{"rendered":"<p>\u672c\u6587\u8bb2\u8ff0\u901a\u8fc7Windows\u7aef\u7684\u8f6f\u4ef6WinSCP\u901a\u8fc7ssh\u534f\u8bae\u8fde\u63a5VM\u4e0b\u7684linux centos8\u3002\u8fde\u63a5\u7684\u539f\u7406\u56fe\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/55-543925-20211220165206996-698606225.png\" alt=\"\" loading=\"lazy\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;\u6240\u4ee5\uff0ccentos\u7cfb\u7edf\u4e0a\u5fc5\u987b\u5b89\u88c5openssh-server\uff0c\u7c7b\u4f3c\u4e8e\u670d\u52a1\u5668\u7aef\u3002\uff08\u56e0\u4e3a\u662f\u4f7f\u7528Windows\u4e0b\u7684\u8f6f\u4ef6\u6765\u8bbf\u95eelinux\uff0c\u6240\u4ee5Linux\u4e0b\u4e0d\u9700\u8981\u5b89\u88c5openssh\u7684\u5ba2\u6237\u7aef\uff09openssh-client\u5728Windows\u4e0b\u7684\u5f88\u591a\u8f6f\u4ef6\u4e2d\u90fd\u652f\u6301\uff0c\u5982\u4e0a\u56fe\u6240\u793a\u8f6f\u4ef6\uff0c\u6240\u4ee5\u672c\u6587\u7684\u91cd\u70b9\u662f\u914d\u7f6elinux\u4e0b\u7684ssh\u670d\u52a1\u5668\u3002<\/p>\n<p>1.\u67e5\u770bcentos\u4e2d\u662f\u5426\u5b89\u88c5\u4e86openssh-server\u3002\u67e5\u770b\u547d\u4ee4\uff1ayum list installed | grep openssh-server<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/56-543925-20211220165322035-722382889.png\" alt=\"\" loading=\"lazy\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u4e0a\u56fe\u663e\u793a\u5df2\u7ecf\u5b89\u88c5\uff0c\u5982\u679c\u6ca1\u4efb\u4f55\u8f93\u51fa\u663e\u793a\u8868\u793a\u6ca1\u6709\u5b89\u88c5 openssh-server\uff0c\u901a\u8fc7\u8f93\u5165 yum install openssh-server\u6765\u5b89\u88c5\u3002<\/p>\n<p>2.\u4fee\u6539 \/etc\/ssh\/ \u76ee\u5f55\u4e0b\u7684sshd\u670d\u52a1\u914d\u7f6e\u6587\u4ef6 sshd_config\u3002\uff08\u6ce8\u610f\u4e00\u5b9a\u662fsshd_config\u6587\u4ef6\uff0c\u5982\u679c\u7cfb\u7edf\u4e2d\u5b89\u88c5\u6709openssh-client\uff0c\u5c31\u4f1a\u6709ssh_config\u6587\u4ef6\uff0c\u522b\u627e\u9519\u4e86\u6587\u4ef6\uff09<br \/>vi \/etc\/ssh\/sshd_config \uff08\u4ee5\u4e0b\u662f\u4e00\u4e9b\u57fa\u672c\u914d\u7f6e\uff09<\/p>\n<p>Port&ensp;22&ensp;&ensp;#\u5b9a\u4e49ssh\u76d1\u542c\u7684\u7aef\u53e3\u53f7\uff0c\u9ed8\u8ba4\u4e3a22&ensp;<br \/>ListenAddress&ensp;0.0.0.0&ensp;&ensp;#\u8bbe\u7f6essh\u670d\u52a1\u5668\u7ed1\u5b9a\u7684ip\u5730\u5740\uff0c\u9ed8\u8ba4\u4e3a\u6240\u6709\u53ef\u7528\u7684ip\u5730\u5740&ensp;<\/p>\n<p>&nbsp;<img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/57-543925-20211220165745363-417294986.png\" alt=\"\" loading=\"lazy\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>PermitRootLogin&ensp;yes&ensp;#\u8bbe\u7f6e\u662f\u5426\u5141\u8bb8root\u767b\u5f55\uff0c\u9ed8\u8ba4\u5141\u8bb8<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/58-543925-20211220165906395-114160013.png\" alt=\"\" loading=\"lazy\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;#PermitEmptyPasswords&ensp;no&ensp;#\u8bbe\u7f6e\u662f\u5426\u5141\u8bb8\u7a7a\u5bc6\u7801\u7684\u5ba2\u6237\u767b\u5f55\uff0c\u9ed8\u8ba4\u4e3a\u7981\u6b62<\/p>\n<p>PasswordAuthentication&ensp;yes&ensp;#\u8bbe\u7f6e\u662f\u5426\u4f7f\u7528\u53e3\u4ee4\u8ba4\u8bc1\u65b9\u5f0f\uff0c\u5982\u679c\u8981\u4f7f\u7528\u516c\u94a5\u8ba4\u8bc1\u65b9\u5f0f\uff0c\u53ef\u5c06\u5176\u8bbe\u7f6e\u4e3ano<\/p>\n<p>&nbsp;<img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/59-543925-20211220170028070-2113828504.png\" alt=\"\" loading=\"lazy\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;3.\u542f\u52a8sshd\u670d\u52a1\u3002<\/p>\n<p><em id=\"__mceDel\">service sshd start \u542f\u52a8sshd\u670d\u52a1\u3002<br \/>ps -e | grep sshd \u68c0\u67e5sshd\u670d\u52a1\u662f\u5426\u5df2\u7ecf\u542f\u52a8\u3002<\/em><\/p>\n<p>systemctl status sshd.service<\/p>\n<p>\u5c06sshd\u670d\u52a1\u6dfb\u52a0\u4e4b\u81ea\u542f\u52a8\u5217\u8868\u4e2d\uff0c\u5e76\u67e5\u770b\u662f\u5426\u5f00\u542f\u81ea\u542f\u52a8sshd\u670d\u52a1\u3002<br \/>systemctl enable sshd.service<br \/>systemctl list-unit-files | grep sshd<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/60-543925-20211220170232522-2035118351.png\" alt=\"\" loading=\"lazy\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<em id=\"__mceDel\">4.\u786e\u8ba4centos\u548cPC\u4e4b\u95f4\u7f51\u7edc\u4e92\u901a\uff0c\u5e76\u4e14\u67e5\u770bcentos\u7684ip\u5730\u5740\u3002<\/em><\/p>\n<p><em id=\"__mceDel\">\u8fd9\u91cc\u5728centos\u4e0a\u8bbf\u95ee\u5916\u7f51\u6765\u9a8c\u8bc1\u7f51\u7edc\u662f\u901a\u7684\u3002<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>ifconfig -a \u67e5\u770bcentos\u7684ip\u5730\u5740\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/61-543925-20211220170515233-1446574821.png\" alt=\"\" loading=\"lazy\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;5.\u4f7f\u7528winscp\u6765\u8fde\u63a5\u8bbf\u95eecentos8\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/62-543925-20211220170603197-2022944903.png\" alt=\"\" loading=\"lazy\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/63-543925-20211220170657313-1902064236.png\" alt=\"\" loading=\"lazy\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u8bb2\u8ff0\u901a\u8fc7Windows\u7aef\u7684\u8f6f\u4ef6WinSCP\u901a\u8fc7ssh\u534f\u8bae\u8fde\u63a5VM\u4e0b\u7684linux centos8\u3002\u8fde\u63a5\u7684\u539f\u7406 &hellip; <a href=\"http:\/\/blog.langmanezhuang.com\/index.php\/2021\/12\/20\/centos-8-sshd-%e6%97%a0%e6%b3%95%e8%bf%9e%e6%8e%a5\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">centos 8 sshd \u65e0\u6cd5\u8fde\u63a5<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,1],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts\/843"}],"collection":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/comments?post=843"}],"version-history":[{"count":1,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts\/843\/revisions"}],"predecessor-version":[{"id":946,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts\/843\/revisions\/946"}],"wp:attachment":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/media?parent=843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/categories?post=843"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/tags?post=843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}