{"id":1358,"date":"2024-08-02T18:40:43","date_gmt":"2024-08-02T10:40:43","guid":{"rendered":"https:\/\/blog.humh.cn\/?p=1358"},"modified":"2024-08-02T18:40:44","modified_gmt":"2024-08-02T10:40:44","slug":"ssh%e4%bd%bf%e7%94%a8%e5%85%ac%e9%92%a5%e8%bf%9e%e6%8e%a5%e5%a4%b1%e8%b4%a5","status":"publish","type":"post","link":"https:\/\/blog.humh.cn\/?p=1358","title":{"rendered":"ssh\u4f7f\u7528\u516c\u94a5\u8fde\u63a5\u5931\u8d25"},"content":{"rendered":"\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> ~\/.ssh \ue0b0 ssh aliyun.beijing\nroot@aliyun.beijing: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).<\/pre>\n\n\n\n<p>\u5f53\u6211 ssh \u6211\u7684\u4e3b\u673a\u65f6\uff0c\u62a5\u4e86\u5982\u4e0a\u7684\u9519\u8bef\u3002\u9519\u8bef\u5f88\u7b80\u7565\uff0c\u4e0d\u5229\u4e8e\u6392\u67e5\uff0c\u8fd9\u65f6\u53ef\u4ee5\u5e26\u4e0a`-v`\u53c2\u6570\u518d ssh\uff0c\u4f1a\u6253\u51fa\u8be6\u7ec6\u7684 DEBUG \u65e5\u5fd7\uff0c\u7ecf\u8fc7\u548c ssh \u5176\u4ed6\u4e3b\u673a\u6210\u529f\u7684\u65e5\u5fd7\u5bf9\u6bd4\u53d1\u73b0<\/p>\n\n\n\n<p>\u5f02\u5e38\u7684\u65e5\u5fd7<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>debug1: Local version string SSH-2.0-OpenSSH_9.0\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1\n......\ndebug1: Will attempt key: \/Users\/humh\/.ssh\/id_rsa RSA SHA256:xxxx explicit\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\ndebug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic\ndebug1: Next authentication method: publickey\ndebug1: Offering public key: \/Users\/humh\/.ssh\/id_rsa RSA SHA256:xxxx explicit\ndebug1: send_pubkey_test: no mutual signature algorithm\ndebug1: No more authentication methods to try.<\/code><\/pre>\n\n\n\n<p>\u6210\u529f\u7684\u65e5\u5fd7<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><meta charset=\"utf-8\">debug1: Local version string SSH-2.0-OpenSSH_9.0\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_8.0\n......\ndebug1: Will attempt key: \/Users\/humh\/.ssh\/id_rsa RSA SHA256:xxxx explicit\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\ndebug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic\ndebug1: Next authentication method: publickey\ndebug1: Offering public key: \/Users\/humh\/.ssh\/id_rsa RSA SHA256:xxxx explicit\ndebug1: Server accepts key: \/Users\/humh\/.ssh\/id_rsa RSA SHA256:xxxx explicit\nAuthenticated to aliyun.beijing (&#91;xx.xx.xx.xx]:22) using \"publickey\".<\/code><\/pre>\n\n\n\n<p>\u9047\u5230 &#8220;send_pubkey_test: no mutual signature algorithm&#8221; \u7684\u9519\u8bef\u901a\u5e38\u610f\u5473\u7740 SSH \u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u6ca1\u6709\u627e\u5230\u5171\u540c\u652f\u6301\u7684\u7b7e\u540d\u7b97\u6cd5\u3002SSH \u534f\u8bae\u5728\u8fdb\u884c\u516c\u94a5\u8ba4\u8bc1\u65f6\uff0c\u9700\u8981\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u90fd\u652f\u6301\u76f8\u540c\u7684\u7b7e\u540d\u7b97\u6cd5\u3002<\/p>\n\n\n\n<p>\u8fd9\u91cc\u6211\u9700\u8981\u77e5\u9053\u51e0\u70b9\u57fa\u7840\u77e5\u8bc6\uff1a<\/p>\n\n\n\n<p>\u5982\u4f55\u77e5\u9053\u516c\u94a5\u6587\u4ef6\u7684\u7c7b\u578b\uff0c\u5982\u7b97\u6cd5\u7c7b\u578b\uff1f<br><code>ssh-keygen -l -f ~\/.ssh\/id_rsa.pub<\/code><\/p>\n\n\n\n<p>\u4e00\u4e2a\u516c\u94a5\u662fRSA\u7b97\u6cd5\u751f\u6210\u7684\u5e76\u4e14\u6307\u7eb9\u4f7f\u7528SHA256\u8ba1\u7b97\u7684\uff0c\u4f46\u5728\u8fde\u63a5\u65f6\u4e5f\u53ef\u4ee5\u4f7f\u7528\u5176\u4ed6\u7b97\u6cd5\u5417\uff1f<br>\u5f53\u5ba2\u6237\u7aef\u63d0\u4f9b\u4e00\u4e2a\u4f7f\u7528 RSA \u7b97\u6cd5\u751f\u6210\u7684\u516c\u94a5\uff0c\u5e76\u4e14\u8be5\u516c\u94a5\u7684\u6307\u7eb9\u4f7f\u7528 SHA256 \u8ba1\u7b97\u65f6\uff0c\u8fd9\u5e76\u4e0d\u610f\u5473\u7740\u8fde\u63a5\u65f6\u53ea\u80fd\u4f7f\u7528 ssh-rsa \u7b97\u6cd5\u3002\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u4e4b\u95f4\u7684\u534f\u5546\u8fc7\u7a0b\u5141\u8bb8\u4f7f\u7528\u591a\u79cd\u7b97\u6cd5\uff0c\u5305\u62ec\u516c\u94a5\u8ba4\u8bc1\u7b97\u6cd5\u3001\u52a0\u5bc6\u7b97\u6cd5\u7b49\u3002\u5373\u4f7f\u5ba2\u6237\u7aef\u63d0\u4f9b\u4e86\u4e00\u4e2a\u4f7f\u7528 RSA \u7b97\u6cd5\u751f\u6210\u7684\u516c\u94a5\uff0c\u5b83\u4ecd\u7136\u53ef\u4ee5\u63d0\u4f9b\u5176\u4ed6\u7c7b\u578b\u7684\u516c\u94a5\u4f9b\u670d\u52a1\u7aef\u9009\u62e9\u3002<\/p>\n\n\n\n<p>\u5c3d\u7ba1\u5ba2\u6237\u7aef\u63d0\u4f9b\u7684\u516c\u94a5\u662f\u4f7f\u7528 RSA \u7b97\u6cd5\u751f\u6210\u7684\uff0c\u4f46\u662f\u6700\u7ec8\u4f7f\u7528\u7684\u7b97\u6cd5\u53d6\u51b3\u4e8e\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u534f\u5546\u7ed3\u679c\u3002<br>\u5177\u4f53\u6765\u8bf4\uff1a<\/p>\n\n\n\n<p>\u5ba2\u6237\u7aef\u63d0\u4f9b\u7684\u7b97\u6cd5\uff1a<br>\u5ba2\u6237\u7aef\u4f1a\u5411\u670d\u52a1\u5668\u63d0\u4f9b\u4e00\u7cfb\u5217\u5b83\u652f\u6301\u7684\u7b97\u6cd5\uff0c\u5305\u62ec\u516c\u94a5\u8ba4\u8bc1\u7b97\u6cd5\u3001\u52a0\u5bc6\u7b97\u6cd5\u7b49\u3002<br>\u5ba2\u6237\u7aef\u901a\u8fc7\u53d1\u9001\u8fd9\u4e9b\u7b97\u6cd5\u5217\u8868\u6765\u544a\u77e5\u670d\u52a1\u5668\u5b83\u53ef\u4ee5\u652f\u6301\u54ea\u4e9b\u7b97\u6cd5\u3002<\/p>\n\n\n\n<p>\u670d\u52a1\u5668\u9009\u62e9\u7684\u7b97\u6cd5\uff1a<br>\u670d\u52a1\u5668\u4f1a\u4ece\u5ba2\u6237\u7aef\u63d0\u4f9b\u7684\u7b97\u6cd5\u5217\u8868\u4e2d\u9009\u62e9\u5b83\u652f\u6301\u7684\u7b97\u6cd5\u3002<br>\u670d\u52a1\u5668\u53ef\u80fd\u4f1a\u6839\u636e\u81ea\u5df1\u7684\u914d\u7f6e\u6765\u8fdb\u4e00\u6b65\u9650\u5236\u53ef\u7528\u7684\u7b97\u6cd5\uff0c\u4f8b\u5982\u901a\u8fc7 \/etc\/ssh\/sshd_config \u6587\u4ef6\u4e2d\u7684 PubkeyAcceptedAlgorithms \u9009\u9879\u6765\u6307\u5b9a\u652f\u6301\u7684\u516c\u94a5\u7b97\u6cd5\u3002<\/p>\n\n\n\n<p>\u534f\u5546\u8fc7\u7a0b<br>\u5ba2\u6237\u7aef\u63d0\u4f9b\u7b97\u6cd5\u5217\u8868\uff1a<br>\u5ba2\u6237\u7aef\u5411\u670d\u52a1\u5668\u53d1\u9001\u4e00\u4e2a\u7b97\u6cd5\u5217\u8868\uff0c\u8fd9\u4e9b\u7b97\u6cd5\u5305\u62ec\u5ba2\u6237\u7aef\u652f\u6301\u7684\u6240\u6709\u7b97\u6cd5\u3002<\/p>\n\n\n\n<p>\u670d\u52a1\u5668\u9009\u62e9\u7b97\u6cd5\uff1a<br>\u670d\u52a1\u5668\u4ece\u5ba2\u6237\u7aef\u63d0\u4f9b\u7684\u7b97\u6cd5\u5217\u8868\u4e2d\u9009\u62e9\u5b83\u652f\u6301\u7684\u7b97\u6cd5\u3002<br>\u670d\u52a1\u5668\u53ef\u80fd\u4f1a\u8fdb\u4e00\u6b65\u8fc7\u6ee4\u8fd9\u4e2a\u5217\u8868\uff0c\u4ee5\u7b26\u5408\u5176\u81ea\u8eab\u7684\u914d\u7f6e\u3002<\/p>\n\n\n\n<p>\u534f\u5546\u7ed3\u679c\uff1a<br>\u6700\u7ec8\u4f7f\u7528\u7684\u7b97\u6cd5\u662f\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u5171\u540c\u652f\u6301\u7684\u90a3\u4e2a\u7b97\u6cd5\u3002<\/p>\n\n\n\n<p>\u793a\u4f8b<br>\u5047\u8bbe\u5ba2\u6237\u7aef\u63d0\u4f9b\u4e86\u4ee5\u4e0b\u7b97\u6cd5\u5217\u8868\uff1a<br>ssh-rsa<br>ssh-ed25519<br>ecdsa-sha2-nistp256<br>\u5982\u679c\u670d\u52a1\u5668\u914d\u7f6e\u4e3a\uff1a<br>PubkeyAcceptedAlgorithms ssh-rsa,ssh-ed25519<br>\u5219\u6700\u7ec8\u534f\u5546\u7684\u7ed3\u679c\u5c06\u662f\uff1a<br>\u5982\u679c\u670d\u52a1\u5668\u652f\u6301 ssh-rsa \u548c ssh-ed25519\uff0c\u5219\u6700\u7ec8\u4f7f\u7528\u7684\u7b97\u6cd5\u53ef\u80fd\u662f ssh-rsa \u6216 ssh-ed25519\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u670d\u52a1\u5668\u7684\u4f18\u5148\u7ea7\u8bbe\u7f6e\u3002<br>\u63a7\u5236\u6743<br>\u5ba2\u6237\u7aef\uff1a\u63d0\u4f9b\u7b97\u6cd5\u5217\u8868\uff0c\u4f46\u4e0d\u80fd\u63a7\u5236\u6700\u7ec8\u4f7f\u7528\u7684\u7b97\u6cd5\u3002<br>\u670d\u52a1\u5668\uff1a\u4ece\u5ba2\u6237\u7aef\u63d0\u4f9b\u7684\u7b97\u6cd5\u5217\u8868\u4e2d\u9009\u62e9\u7b97\u6cd5\uff0c\u5e76\u6839\u636e\u81ea\u5df1\u7684\u914d\u7f6e\u6765\u8fdb\u4e00\u6b65\u9650\u5236\u53ef\u7528\u7684\u7b97\u6cd5\u3002<\/p>\n\n\n\n<p>\u603b\u7ed3<br>\u534f\u5546\u8fc7\u7a0b\u4e2d\u53ef\u4ee5\u4f7f\u7528\u7684\u7b97\u6cd5\uff1a\u662f\u7531\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u5171\u540c\u51b3\u5b9a\u7684\u3002<br>\u63a7\u5236\u6743\uff1a\u670d\u52a1\u5668\u5177\u6709\u6700\u7ec8\u7684\u51b3\u7b56\u6743\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u4ece\u5ba2\u6237\u7aef\u63d0\u4f9b\u7684\u7b97\u6cd5\u5217\u8868\u4e2d\u9009\u62e9\u7b97\u6cd5\uff0c\u5e76\u6839\u636e\u81ea\u5df1\u7684\u914d\u7f6e\u6765\u8fdb\u4e00\u6b65\u9650\u5236\u53ef\u7528\u7684\u7b97\u6cd5\u3002<br>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u80fd\u591f\u534f\u5546\u51fa\u53cc\u65b9\u90fd\u652f\u6301\u7684\u6700\u4f73\u7b97\u6cd5\uff0c\u4ece\u800c\u786e\u4fdd\u8fde\u63a5\u7684\u5b89\u5168\u6027\u548c\u517c\u5bb9\u6027\u3002<\/p>\n\n\n\n<p>sshd -T \u53ef\u4ee5\u67e5\u8be2\u670d\u52a1\u7aef\u652f\u6301\u54ea\u4e9b\u7b97\u6cd5<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u6211 ssh \u6211\u7684\u4e3b\u673a\u65f6\uff0c\u62a5\u4e86\u5982\u4e0a\u7684\u9519\u8bef\u3002\u9519\u8bef\u5f88\u7b80\u7565\uff0c\u4e0d\u5229\u4e8e\u6392\u67e5\uff0c\u8fd9\u65f6\u53ef\u4ee5\u5e26\u4e0a`-v`\u53c2\u6570\u518d ssh\uff0c\u4f1a\u6253\u51fa\u8be6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[53],"tags":[31,104],"_links":{"self":[{"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/posts\/1358"}],"collection":[{"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1358"}],"version-history":[{"count":1,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/posts\/1358\/revisions"}],"predecessor-version":[{"id":1359,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=\/wp\/v2\/posts\/1358\/revisions\/1359"}],"wp:attachment":[{"href":"https:\/\/blog.humh.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.humh.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}