{"id":594,"date":"2022-10-08T12:15:48","date_gmt":"2022-10-08T04:15:48","guid":{"rendered":"http:\/\/blog.nonot.cn\/?p=594"},"modified":"2024-07-08T12:46:40","modified_gmt":"2024-07-08T04:46:40","slug":"linux%e7%af%87%e4%b9%8b%e6%b7%bb%e5%8a%a0%e6%88%96%e4%bf%ae%e6%94%b9ssh%e6%9c%8d%e5%8a%a1%e7%9a%84%e7%ab%af%e5%8f%a3%e5%92%8c%e9%80%9a%e8%bf%87%e6%8c%87%e5%ae%9a%e7%ab%af%e5%8f%a3%e8%bf%9b%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/blog.nonot.cn\/index.php\/2022\/10\/08\/linux%e7%af%87%e4%b9%8b%e6%b7%bb%e5%8a%a0%e6%88%96%e4%bf%ae%e6%94%b9ssh%e6%9c%8d%e5%8a%a1%e7%9a%84%e7%ab%af%e5%8f%a3%e5%92%8c%e9%80%9a%e8%bf%87%e6%8c%87%e5%ae%9a%e7%ab%af%e5%8f%a3%e8%bf%9b%e8%a1%8c\/","title":{"rendered":"Linux\u7bc7\u4e4b\u6dfb\u52a0\u6216\u4fee\u6539ssh\u670d\u52a1\u7684\u7aef\u53e3\u548c\u901a\u8fc7\u6307\u5b9a\u7aef\u53e3\u8fdb\u884c\u8fde\u63a5"},"content":{"rendered":"<p>\u4e00\u3001\u524d\u8a00<br \/>\n\u901a\u5e38\u6765\u8bf4\uff0c\u670d\u52a1\u5668\u9ed8\u8ba4\u7684ssh\u8fdc\u7a0b\u767b\u5f55\u7aef\u53e3\u4e3a22\uff0c\u4f46\u662f\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u4e3a\u4e86\u4fdd\u8bc1\u670d\u52a1\u5668\u7684\u5b89\u5168\u53ef\u9760\u6027\u3001\u9632\u6b62\u6076\u610f\u653b\u51fb\u3001\u6076\u610f\u8fde\u63a5\u7b49\uff0c\u6211\u4eec\u53ef\u4ee5\u8fdb\u884c\u8fdc\u7a0b\u7aef\u53e3\u7684\u4fee\u6539\u3002<br \/>\nssh\u914d\u7f6e\u6587\u4ef6\u4f4d\u7f6e\u5728\/etc\/ssh\/sshd_config \u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u7f16\u8f91\u6587\u4ef6\u6765\u8fdb\u884c\u4fee\u6539sshd\u670d\u52a1\u7684\u76f8\u5173\u914d\u7f6e\u3002<\/p>\n<p>\u4e8c\u3001\u4fee\u6539ssh\u670d\u52a1\u7684\u7aef\u53e3<br \/>\n1\u3001\u901a\u8fc7\u6267\u884c vim \/etc\/ssh\/sshd_config\uff0c\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4e3a\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u7aef\u53e3\u4e3a22<\/p>\n<p>2\u3001\u5f53\u6211\u4eec\u8981\u8fdb\u884c\u7aef\u53e3\u4fee\u6539\u65f6\uff0c\u6b64\u65f6\u9700\u8981\u53bb\u6389\u6ce8\u91ca\u5e76\u65b0\u589e\u4e00\u884c Port<br \/>\n\u5047\u8bbe\u65b0\u589e\u7aef\u53e3\u4e3a\uff1a2223<br \/>\n\u5982\u4e0b\uff1a<\/p>\n<p>3\u3001\u4fee\u6539\u5b8c\u540e\uff0c\u7136\u540e\u91cd\u542fssh\u670d\u52a1<\/p>\n<p>systemctl restart sshd<br \/>\n1<br \/>\n\u91cd\u542f\u5b8c\u6210\u540e\uff0c22\u7aef\u53e3\u548c2223\u7aef\u53e3\u5c31\u5747\u53ef\u4ee5\u8fdb\u884c\u8fde\u63a5\u4e86\u3002<\/p>\n<p>\u4e09\u3001\u901a\u8fc7\u6307\u5b9a\u7aef\u53e3\u8fde\u63a5<br \/>\n1\u3001\u8fde\u63a5\u6307\u4ee4\uff1a\u5f53\u4e0d\u662f\u91c7\u7528\u9ed8\u8ba4\u7aef\u53e3\u65f6\u4f7f\u7528 ssh -p 2223 hostname \u6216\u8005 ssh hostname:2223\u8fdb\u884c\u8fde\u63a5\uff0c\u5176\u4e2dhostname\u8868\u793a\u4e3b\u673a\u540d\u3002<br \/>\n\u5f53\u91c7\u7528\u9ed8\u8ba4\u9ed8\u8ba4\u65f6\uff0c\u76f4\u63a5\u6267\u884cssh hostname \u5373\u53ef\u3002<\/p>\n<p>2\u3001\u6ce8\u610f\u4e8b\u9879\uff1a<span style=\"color: #ff0000;\"><strong>\u8fd9\u91cc\u9700\u8981\u6ce8\u610fselinux\u6709\u6ca1\u6709\u5173\u95ed\uff0c\u5982\u679cselinux\u6ca1\u6709\u5173\u95ed\u7684\u8bdd\uff0c\u7aef\u53e3\u4f1a\u7ed1\u5b9a\u5931\u8d25\u3002<\/strong><\/span><br \/>\n<span style=\"color: #ff0000;\"><strong>\u6b64\u65f6\u67e5\u770bsystemctl status sshd.service \u547d\u4ee4<\/strong><\/span><br \/>\n<span style=\"color: #ff0000;\"><strong>\u67e5\u770b\u72b6\u6001\u65f6\u4f1a\u53d1\u73b0error: Bind to port 2223 on 0.0.0.0 failed: Permission denied,\u7684\u9519\u8bef\uff0c\u8fd9\u79cd\u60c5\u51b5\u6539\u4e0b\uff0c\u8981\u5173\u95edselinux\uff0c\u7136\u540e\u518d\u6b21\u91cd\u65b0\u542f\u52a8ssh\u670d\u52a1\uff0c\u65b0\u7684\u7aef\u53e3\u624d\u53ef\u4ee5\u751f\u6548\u3002<\/strong><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u524d\u8a00 \u901a\u5e38\u6765\u8bf4\uff0c\u670d\u52a1\u5668\u9ed8\u8ba4\u7684ssh\u8fdc\u7a0b\u767b\u5f55\u7aef\u53e3\u4e3a22\uff0c\u4f46&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-594","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/comments?post=594"}],"version-history":[{"count":1,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/594\/revisions"}],"predecessor-version":[{"id":1180,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/594\/revisions\/1180"}],"wp:attachment":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/media?parent=594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/categories?post=594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/tags?post=594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}