{"id":748,"date":"2022-09-23T13:50:16","date_gmt":"2022-09-23T05:50:16","guid":{"rendered":"https:\/\/www.jchj.top\/?p=748"},"modified":"2025-09-26T11:25:54","modified_gmt":"2025-09-26T03:25:54","slug":"openssh%e5%8d%87%e7%ba%a7","status":"publish","type":"post","link":"https:\/\/www.jchj.top\/?p=748","title":{"rendered":"OpenSSH\u5347\u7ea7"},"content":{"rendered":"\n<p>\u5907\u4efd\/etc\/ssh\u76ee\u5f55<\/p>\n\n\n\n<p># cp -rp \/etc\/ssh \/etc\/ssh.bak<\/p>\n\n\n\n<p>\u5fc5\u8981\u8f6f\u4ef6\u7684\u5b89\u88c5<\/p>\n\n\n\n<p># yum install gcc zlib zlib-devel openssl-devel<\/p>\n\n\n\n<p>\u67e5\u770b\u5f53\u524dOpenSSH\u7248\u672c<\/p>\n\n\n\n<p># ssh -V<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1010\" height=\"65\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2022\/09\/1-22.png\" alt=\"\" class=\"wp-image-749\"\/><\/figure>\n\n\n\n<p>\u4e0b\u8f7dOpenSSH\u65b0\u7248\u672c <a href=\"https:\/\/cdn.openbsd.org\/pub\/OpenBSD\/OpenSSH\/portable\/\" data-type=\"URL\" data-id=\"https:\/\/cdn.openbsd.org\/pub\/OpenBSD\/OpenSSH\/portable\/\">https:\/\/cdn.openbsd.org\/pub\/OpenBSD\/OpenSSH\/portable\/<\/a><\/p>\n\n\n\n<p>wget <a href=\"https:\/\/cdn.openbsd.org\/pub\/OpenBSD\/OpenSSH\/portable\/openssh-8.5p1.tar.gz\">https:\/\/cdn.openbsd.org\/pub\/OpenBSD\/OpenSSH\/portable\/openssh-8.5p1.tar.gz<\/a><\/p>\n\n\n\n<p>\u5b89\u88c5<\/p>\n\n\n\n<p>tar zxvf openssh-8.5p1.tar.gz<\/p>\n\n\n\n<p>cd openssh-8.5p1<\/p>\n\n\n\n<p>.\/configure<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1588\" height=\"614\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2022\/09\/2-22.png\" alt=\"\" class=\"wp-image-750\"\/><\/figure>\n\n\n\n<p>make<\/p>\n\n\n\n<p>make install<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1378\" height=\"647\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2022\/09\/3-21.png\" alt=\"\" class=\"wp-image-751\"\/><\/figure>\n\n\n\n<p>\u7981\u7528\u539f\u5148\u7684SSH\u670d\u52a1\uff0c\u5e76\u79fb\u9664\u670d\u52a1\u6587\u4ef6<\/p>\n\n\n\n<p>systemctl disable sshd<\/p>\n\n\n\n<p>mv \/usr\/lib\/systemd\/system\/sshd.service \/sshd.service<\/p>\n\n\n\n<p>\u5728OpenSSH_8.0p1\u6e90\u7801\u5305\u4e2d\uff0c\u628a\u4e00\u4e9b\u670d\u52a1\u6587\u4ef6\u590d\u5236\u5230\u7cfb\u7edf\u4e2d\uff1a<\/p>\n\n\n\n<p>cp contrib\/redhat\/sshd.init \/etc\/init.d\/sshd<\/p>\n\n\n\n<p>cp contrib\/redhat\/sshd.pam \/etc\/pam.d\/sshd.pam<\/p>\n\n\n\n<p>chmod +x \/etc\/init.d\/sshd<\/p>\n\n\n\n<p>\u4fee\u6539\/etc\/init.d\/sshd\u4e2d\u7684SSHD\u8def\u5f84\uff1a<\/p>\n\n\n\n<p>vim \/etc\/init.d\/sshd<\/p>\n\n\n\n<p>SSHD=\/usr\/local\/sbin\/sshd<\/p>\n\n\n\n<p>\u542f\u7528\u65b0\u7684sshd\u540e\uff0c\u7531\u4e8e\u65b0\u7248\u672c\u7684OpenSSH\u9ed8\u8ba4\u4e0d\u5141\u8bb8root\u7528\u6237\u767b\u5f55\uff0c\u5982\u679c\u9700\u8981\u4f7f\u7528root\u8fdc\u7a0b\u767b\u5f55\uff0c\u8fd8\u9700\u8981\u505a\u4e00\u4e0b\u8bbe\u7f6e\u3002\u5982\u679c\u4e0d\u9700\u8981\uff0c\u53ef\u4ee5\u76f4\u63a5\u91cd\u542f\u670d\u52a1\u3002<\/p>\n\n\n\n<p>\u65b0\u7684OpenSSH\u7684\u914d\u7f6e\u6587\u4ef6\u662f\u5728\/usr\/local\/etc\/\u8fd9\u4e2a\u76ee\u5f55\u4e0b\uff0c\u7f16\u8f91\/usr\/local\/etc\/sshd_config\uff1a<\/p>\n\n\n\n<p>vim \/usr\/local\/etc\/sshd_config<\/p>\n\n\n\n<p>PermitRootLogin yes<\/p>\n\n\n\n<p>\u91cd\u542f\u670d\u52a1<\/p>\n\n\n\n<p>systemctl daemon-reload<\/p>\n\n\n\n<p>systemctl start sshd<\/p>\n\n\n\n<p>\u67e5\u770b\u7248\u672c\uff1a<\/p>\n\n\n\n<p>sshd -V<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"981\" height=\"125\" src=\"https:\/\/www.jchj.top\/wp-content\/uploads\/2022\/09\/4-20.png\" alt=\"\" class=\"wp-image-752\"\/><\/figure>\n\n\n\n<p>\u52a0\u5165\u5f00\u673a\u81ea\u542f\u52a8<\/p>\n\n\n\n<p>vi \/etc\/rc.local<\/p>\n\n\n\n<p>\u672b\u5c3e\u6dfb\u52a0\uff1a<\/p>\n\n\n\n<p>\/etc\/init.d\/sshd<\/p>\n\n\n\n<p>systemctl enable sshd<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5907\u4efd\/etc\/ssh\u76ee\u5f55 # cp -rp \/et&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,7,1],"tags":[],"class_list":["post-748","post","type-post","status-publish","format-standard","hentry","category-linux","category-7","category-1"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/posts\/748","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jchj.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=748"}],"version-history":[{"count":2,"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/posts\/748\/revisions"}],"predecessor-version":[{"id":764,"href":"https:\/\/www.jchj.top\/index.php?rest_route=\/wp\/v2\/posts\/748\/revisions\/764"}],"wp:attachment":[{"href":"https:\/\/www.jchj.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jchj.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jchj.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}