{"id":357,"date":"2024-05-16T11:15:39","date_gmt":"2024-05-16T03:15:39","guid":{"rendered":"http:\/\/www.inhhh.com\/blog\/?p=357"},"modified":"2024-05-16T11:15:39","modified_gmt":"2024-05-16T03:15:39","slug":"openssh%e7%a7%bb%e6%a4%8d%e5%88%b0arm-linux%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"http:\/\/www.inhhh.com\/blog\/?p=357","title":{"rendered":"OpenSSH\u79fb\u690d\u5230ARM Linux\u6559\u7a0b"},"content":{"rendered":"\n<p>\n\nOpenSSH \u662f&nbsp;SSH&nbsp;\uff08Secure&nbsp;SHell\uff09 \u534f\u8bae\u7684\u514d\u8d39\u5f00\u6e90\u5b9e\u73b0\u3002SSH\u534f\u8bae\u65cf\u53ef\u4ee5\u7528\u6765\u8fdb\u884c\u8fdc\u7a0b\u63a7\u5236\uff0c \u9644\u52a0\u7684SFTP\u534f\u8bae\u53ef\u8f7b\u677e\u5b9e\u73b0\u5728\u8ba1\u7b97\u673a\u4e4b\u95f4\u4f20\u9001\u6587\u4ef6\u3002\u800c\u5b9e\u73b0\u6b64\u529f\u80fd\u7684\u4f20\u7edf\u65b9\u5f0f\uff0c\u5982telnet(\u7ec8\u7aef\u4eff\u771f\u534f\u8bae)\u3001 rcp ftp\u3001 rlogin\u3001rsh\u90fd\u662f\u6781\u4e3a\u4e0d\u5b89\u5168\u7684\uff0c\u56e0\u4e3a\u5b83\u4eec\u4f7f\u7528\u660e\u6587\u4f20\u9001\u5bc6\u7801\u3002OpenSSH\u5e38\u5e38\u88ab\u8bef\u8ba4\u4ee5\u4e3a\u4e0eOpenSSL\u6709\u5173\u8054\uff0c\u4f46\u5b9e\u9645\u4e0a\u8fd9\u4e24\u4e2a\u8ba1\u5212\u7684\u6709\u4e0d\u540c\u7684\u76ee\u7684\uff0c\u4e0d\u540c\u7684\u53d1\u5c55\u56e2\u961f\uff0c\u540d\u79f0\u76f8\u8fd1\u53ea\u662f\u56e0\u4e3a\u4e24\u8005\u6709\u540c\u6837\u7684\u8f6f\u4ef6\u53d1\u5c55\u76ee\u6807\u2500\u2500<strong>\u63d0\u4f9b\u5f00\u653e\u6e90\u4ee3\u7801\u7684\u52a0\u5bc6\u901a\u8baf\u8f6f\u4ef6<\/strong>\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1 \u4e0b\u8f7d<\/h2>\n\n\n\n<p>1\u3001\u79fb\u690dopenssh\u9700\u8981\u4e09\u4e2a\u5305\uff1aopenssh\u3001openssl \u548c zlib\uff0c\u5730\u5740\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>zlib\u5b98\u65b9\u4e0b\u8f7d\uff1a<a href=\"http:\/\/www.zlib.net\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/www.zlib.net\/<\/a><\/li><li>openssl\u5b98\u65b9\u4e0b\u8f7d\uff1a<a href=\"http:\/\/www.openssl.org\/source\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/www.openssl.org\/source<\/a><\/li><li>openssh\u5b98\u7f51\u4e0b\u8f7d\uff1a<a href=\"http:\/\/www.openssh.com\/portable.html\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/www.openssh.com\/portable.html<\/a><\/li><\/ul>\n\n\n\n<p>\u56e0\u4e3a\u5b83\u4eec\u4e4b\u95f4\u6ca1\u6709\u7248\u672c\u6240\u8c13\u7684\u7248\u672c\u51b2\u7a81\uff0c\u6240\u4ee5\u90fd\u4e0b\u8f7d\u6700\u65b0\u677f\u7684\u5373\u53ef\u3002\u672c\u6587\u4ee5<strong>zlib-1.2.8.tar.gz<\/strong>\u3001<strong>openssl-1.0.1h.tar.gz<\/strong>\u3001<strong>openssh-6.6p1.tar.gz<\/strong>\u8fd9\u4e09\u4e2a\u7248\u672c\u4e3a\u4f8b\uff0c\u5176\u4ed6\u7248\u672c\u8fc7\u7a0b\u4e00\u6837\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2 \u90e8\u7f72<\/h2>\n\n\n\n<p>\u56e0\u4e3a\u79fb\u690d\u8fc7\u7a0b\u6d89\u53ca\u5230\u4e09\u4e2a\u5305\uff0c\u6240\u4ee5\u5148\u90e8\u7f72\u597d\u5de5\u4f5c\u76ee\u5f55\uff0c\u6709\u5229\u4e8e\u79fb\u690d\u8fc7\u7a0b\u7684\u987a\u5229\u8fdb\u884c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ cd                                                 # \u5207\u6362\u5230\u7528\u6237\u76ee\u5f55\n$ mkdir ssh                                          # \u65b0\u5efa ssh \u5de5\u4f5c\u76ee\u5f55\n$ cd ssh                                             # \u8fdb\u5165 ssh \u76ee\u5f55  \n$ mkdir zlib.install                                 # \u65b0\u5efa zlib \u5b89\u88c5\u76ee\u5f55\uff0c\u79fb\u690d\u8fc7\u7a0b zlib \u955c\u50cf\u4f1a\u5b89\u88c5\u5230\u8be5\u76ee\u5f55\n$ mkdir openssl.install                              # \u65b0\u5efa openssl \u5b89\u88c5\u76ee\u5f55\uff0c\u79fb\u690d\u8fc7\u7a0b openssl \u955c\u50cf\u4f1a\u5b89\u88c5\u5230\u8be5\u76ee\u5f55\n$ export PATH=$PATH:\/usr\/local\/arm-2010q1\/bin\/       # \u914d\u7f6e\u4ea4\u53c9\u7f16\u8bd1\u5668\u8def\u5f84\u5230 PATH \u73af\u5883\u53d8\u91cf<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">3 \u590d\u5236\u89e3\u538b<\/h2>\n\n\n\n<p>\u5c06&nbsp;<strong>zlib-1.2.8.tar.gz<\/strong>\u3001<strong>openssl-1.0.1h.tar.gz<\/strong>\u3001<strong>openssh-6.6p1.tar.gz<\/strong>&nbsp;\u4e09\u4e2a\u6e90\u7801\u5305\u590d\u5236\u5230ssh\u76ee\u5f55\u4e0b\uff0c\u5e76\u89e3\u538b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ tar zxvf zlib-1.2.8.tar.gz\n$ tar zxvf openssl-1.0.1h.tar.gz\n$ tar zxvf openssh-6.6p1.tar.gz<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">4 \u4ea4\u53c9\u7f16\u8bd1 zlib<\/h2>\n\n\n\n<p>\u9996\u5148\u7f16\u8bd1zlib\u6210\u955c\u50cf\uff0c\u4f9b\u6700\u540e\u7f16\u8bd1 openssh \u7528\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ cd zlib-1.2.8\n$ prefix=\/home\/veryarm\/ssh\/zlib.install CC=arm-none-linux-gnueabi-gcc .\/configure\n$ vi Makefile\n$ make\n$ make install<\/pre>\n\n\n\n<p>\u8fd9\u91cc\u7b2c\u4e8c\u90e8\u914d\u7f6e\u7684\u65f6\u5019\uff0cprefix\u524d\u9762\u6ca1\u6709\u201c&#8211;\u201d\uff0cCC\u540e\u9762\u662f\u4ea4\u53c9\u7f16\u8bd1\u5668\uff0c\u201c.\/configure\u201d\u8981\u653e\u5728\u6700\u540e\u3002\u5b8c\u6210\u540e\uff0c\u4f1a\u5728\u6307\u5b9a\u76ee\u5f55\u201c<strong>\/home\/veryarm\/ssh\/zlib.install<\/strong>\u201d\u4e0b\u751f\u6210\u955c\u50cf\u6587\u4ef6\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5&nbsp;\u4ea4\u53c9\u7f16\u8bd1openssl<\/h2>\n\n\n\n<p>\u7f16\u8bd1 openssl \u6210\u955c\u50cf\uff0c\u4e5f\u662f\u4f9b\u6700\u540e\u7f16\u8bd1 openssh \u7528\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ cd ..\/openssl-1.0.1h\n$ .\/Configure --prefix=\/home\/veryarm\/ssh\/openssl.install &nbsp;os\/compiler:arm-none-linux-gnueabi-gcc\n$ make\n$ make install<\/pre>\n\n\n\n<p>\u5176\u4e2d.\/Configure\u7b2c\u4e00\u4e2a\u5b57\u6bcd\u662f\u5927\u5199\u7684\uff0c\u4ea4\u53c9\u7f16\u8bd1\u4f7f\u7528os\/compiler\u6765\u6307\u5b9a\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6&nbsp;\u4ea4\u53c9\u7f16\u8bd1openssh<\/h2>\n\n\n\n<p>\u7f16\u8bd1openssh\u4f1a\u5f15\u7528\u4e0a\u9762\u7f16\u8bd1\u7684zlib\u548copenssl\u7684\u5b89\u88c5\u76ee\u5f55\uff0c\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ cd&nbsp; ..\/openssh-6.6p1\n$ .\/configure --host=arm-none-linux-gnueabi --with-libs --with-zlib=\/home\/veryarm\/ssh\/zlib.install --with-ssl-dir=\/home\/veryarm\/ssh\/openssl.install --disable-etc-default-login CC=arm-none-linux-gnueabi-gcc AR=arm-none-linux-gnueabi-ar\n$ make<\/pre>\n\n\n\n<p>\u6ce8\u610f\uff1aopenssh\u4e0d\u9700\u8981 make install\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7 \u76ee\u6807\u677f\u51c6\u5907<\/h2>\n\n\n\n<p>\u786e\u4fdd\u76ee\u6807\u677f\u4e0a\u6709\u4ee5\u4e0b\u76ee\u5f55\uff0c\u82e5\u6ca1\u6709\uff0c\u5219\u65b0\u5efa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/usr\/local\/bin\n\/usr\/local\/etc\n\/usr\/libexec\n\/var\/run\n\/var\/empty<\/pre>\n\n\n\n<p>\u5c06PC\u673a&nbsp;\/home\/veryarm\/ssh\/openssh-6.6p1\/&nbsp;\u76ee\u5f55\u4e0b\u6587\u4ef6\u62f7\u8d1d\u5230\u76ee\u6807\u677f\u7cfb\u7edf\u4e2d\uff0c\u5177\u4f53\u4e3a\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>scp\u3001sftp\u3001ssh sshd\u3001ssh-add\u3001ssh-agent\u3001ssh-keygen\u3001ssh-keyscan<\/strong>\u51718\u4e2a\u6587\u4ef6\u62f7\u8d1d\u5230\u76ee\u6807\u677f<strong>\/usr\/local\/bin<\/strong><\/li><li><strong>moduli\u3001ssh_config\u3001sshd_config<\/strong>\u51713\u4e2a\u6587\u4ef6\u62f7\u8d1d\u5230\u76ee\u6807\u677f&nbsp;<strong>\/usr\/local\/etc<\/strong><\/li><li><strong>sftp-server\u3001ssh-keysign<\/strong>&nbsp;\u51712\u4e2a\u6587\u4ef6\u62f7\u8d1d\u5230\u76ee\u6807\u677f&nbsp;<strong>\/usr\/libexec<\/strong><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">8 \u751f\u6210Key\u6587\u4ef6<\/h2>\n\n\n\n<p>\u5728\u76ee\u6807\u7248 \/usr\/local\/etc\/ \u76ee\u5f55\u4e0b\u751f\u6210key\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ cd \/usr\/local\/etc\/\n$ ssh-keygen -t rsa -f ssh_host_rsa_key -N \"\"\n$ ssh-keygen -t dsa -f ssh_host_dsa_key -N \"\"\n$ ssh-keygen -t ecdsa -f ssh_host_ecdsa_key -N \"\"\n$ ssh-keygen -t dsa -f ssh_host_ed25519_key -N \"\"<\/pre>\n\n\n\n<p>\u4fee\u6539&nbsp;ssh_host_ed25519_key \u6743\u9650\u4e3a 600\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ chmod 600 ssh_host_ed25519_key<\/pre>\n\n\n\n<p>\u5176\u4e2d ssh_host_ed25519_key \u662fSSH\u7b2c\u4e8c\u7248\u534f\u8bae\u7528\u5230\u7684key\uff0c\u9700\u8981\u4fee\u6539\u6743\u9650\uff0c\u5426\u5219\u4f1a\u63d0\u793a\u4ee5\u4e0b\u9519\u8bef\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Permissions 0644 for '\/usr\/local\/etc\/ssh_host_ed25519_key' are too open.\nIt is required that your private key files are NOT accessible by others.\nThis private key will be ignored.\nbad permissions: ignore key: \/usr\/local\/etc\/ssh_host_ed25519_key\nCould not load host key: \/usr\/local\/etc\/ssh_host_ed25519_key<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">9 \u76ee\u6807\u677f\u7528\u6237\u4fe1\u606f<\/h2>\n\n\n\n<p>\u6253\u5f00 \/etc\/passwd \u6587\u4ef6\uff0c\u5728\u6700\u540e\u6dfb\u52a0\u4e0b\u9762\u8fd9\u4e00\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sshd:x:74:74:Privilege-separated SSH:\/var\/empty\/sshd:\/sbin\/nologin<\/pre>\n\n\n\n<p>\u5982\u679c\u5f00\u53d1\u677f\u7684 root \u7528\u6237\u8fd8\u6ca1\u6709\u5bc6\u7801\uff0c\u952e\u5165\u4ee5\u4e0b\u547d\u4ee4\u7136\u8f93\u5165\u4e24\u6b21\u5bc6\u7801\u6765\u4fee\u6539\uff0c\u5426\u5176\u4ed6\u8bbe\u5907\u65e0\u6cd5\u8fde\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ passwd root<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">10&nbsp;\u6d4b\u8bd5<\/h2>\n\n\n\n<p>\u5728\u76ee\u6807\u677f\u4e0a\u8fd0\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ \/usr\/local\/bin\/sshd<\/pre>\n\n\n\n<p>\u53ef\u4ee5\u7528 ps \u547d\u4ee4\u67e5\u770bsshd\u662f\u5426\u5728\u5de5\u4f5c\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u8fd0\u884c\u7684\u8fc7\u7a0b\u4e2d\u6709\u63d0\u793a\u7f3a\u5c11\u52a8\u6001\u8fde\u63a5\u5e93\uff0c\u53ef\u4ee5\u5728\u4e3b\u673a\u4e0a\u641c\u7d22\u76f8\u5e94\u6587\u4ef6\uff0c\u62f7\u8d1d\u5230\u76ee\u6807\u677f\/lib\/\u76ee\u5f55\u4e0b\u9762\uff0c\u6ce8\u610f\u521b\u5efa\u8f6f\u8fde\u63a5\uff01<br>OK\uff01\u4e0d\u51fa\u610f\u5916\u7684\u8bdd\u53ef\u4ee5\u6210\u529f\uff0c<\/p>\n\n\n\n<p>\u4e3b\u673a\u4e0a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ ssh root@192.168.1.250\uff08\u5f00\u53d1\u677f\u7684ip\uff09<\/pre>\n\n\n\n<p>\u7136\u540e\u8f93\u5165\u5f00\u53d1\u677f\u7684root\u5bc6\u7801\u5c31\u5c31\u53ef\u4ee5\u4e86\u3002\n\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenSSH \u662f&nbsp;SSH&nbsp;\uff08Secure&nbsp;SHell\uff09 \u534f\u8bae\u7684\u514d\u8d39\u5f00\u6e90\u5b9e\u73b0\u3002S<\/p>\n<div class=\"more-link\">\n\t\t\t\t <a href=\"http:\/\/www.inhhh.com\/blog\/?p=357\" class=\"link-btn theme-btn\"><span>Read More <\/span> <i class=\"fa fa-caret-right\"><\/i><\/a>\n\t\t\t<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-357","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/357","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=357"}],"version-history":[{"count":1,"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/357\/revisions"}],"predecessor-version":[{"id":902,"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/357\/revisions\/902"}],"wp:attachment":[{"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=357"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.inhhh.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}