{"version":"1.0","provider_name":"\u5982\u4f55\u64cd\u4f5c & \u6700\u4f73\u8f6f\u4ef6","provider_url":"https:\/\/howto.ping.fm\/zh\/","author_name":"zamozhnii","author_url":"https:\/\/howto.ping.fm\/zh\/","title":"\u7406\u89e3SSH\u516c\u94a5\u8ba4\u8bc1\uff1a\u6982\u8ff0\u548c\u521b\u5efaSSH\u516c\u94a5\u6307\u5357","type":"rich","width":600,"height":338,"html":"<blockquote class=\"wp-embedded-content\" data-secret=\"lSFBbGNn7P\"><a href=\"https:\/\/howto.ping.fm\/zh\/how-does-ssh-key-authentication-work\/\">SSH\u516c\u94a5\u8ba4\u8bc1\u662f\u5982\u4f55\u5de5\u4f5c\u7684\uff1f<\/a><\/blockquote><iframe sandbox=\"allow-scripts\" security=\"restricted\" src=\"https:\/\/howto.ping.fm\/zh\/how-does-ssh-key-authentication-work\/embed\/#?secret=lSFBbGNn7P\" width=\"600\" height=\"338\" title=\"&#8220;SSH\u516c\u94a5\u8ba4\u8bc1\u662f\u5982\u4f55\u5de5\u4f5c\u7684\uff1f&#8221; &#8212; \u5982\u4f55\u64cd\u4f5c &amp; \u6700\u4f73\u8f6f\u4ef6\" data-secret=\"lSFBbGNn7P\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" class=\"wp-embedded-content\"><\/iframe><script>\n\/**\n * WordPress inline HTML embed\n *\n * @since 4.4.0\n * @output wp-includes\/js\/wp-embed.js\n *\n * This file cannot have ampersands in it. This is to ensure\n * it can be embedded in older versions of WordPress.\n * See https:\/\/core.trac.wordpress.org\/changeset\/35708.\n *\/\n(function ( window, document ) {\n\t'use strict';\n\n\tvar supportedBrowser = false,\n\t\tloaded = false;\n\n\t\tif ( document.querySelector ) {\n\t\t\tif ( window.addEventListener ) {\n\t\t\t\tsupportedBrowser = true;\n\t\t\t}\n\t\t}\n\n\t\/** @namespace wp *\/\n\twindow.wp = window.wp || {};\n\n\tif ( !! window.wp.receiveEmbedMessage ) {\n\t\treturn;\n\t}\n\n\t\/**\n\t * Receive embed message.\n\t *\n\t * @param {MessageEvent} e\n\t *\/\n\twindow.wp.receiveEmbedMessage = function( e ) {\n\t\tvar data = e.data;\n\n\t\tif ( ! data ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! ( data.secret || data.message || data.value ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( \/[^a-zA-Z0-9]\/.test( data.secret ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar iframes = document.querySelectorAll( 'iframe[data-secret=\"' + data.secret + '\"]' ),\n\t\t\tblockquotes = document.querySelectorAll( 'blockquote[data-secret=\"' + data.secret + '\"]' ),\n\t\t\tallowedProtocols = new RegExp( '^https?:$', 'i' ),\n\t\t\ti, source, height, sourceURL, targetURL;\n\n\t\tfor ( i = 0; i < blockquotes.length; i++ ) {\n\t\t\tblockquotes[ i ].style.display = 'none';\n\t\t}\n\n\t\tfor ( i = 0; i < iframes.length; i++ ) {\n\t\t\tsource = iframes[ i ];\n\n\t\t\tif ( e.source !== source.contentWindow ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tsource.removeAttribute( 'style' );\n\n\t\t\t\/* Resize the iframe on request. *\/\n\t\t\tif ( 'height' === data.message ) {\n\t\t\t\theight = parseInt( data.value, 10 );\n\t\t\t\tif ( height > 1000 ) {\n\t\t\t\t\theight = 1000;\n\t\t\t\t} else if ( ~~height < 200 ) {\n\t\t\t\t\theight = 200;\n\t\t\t\t}\n\n\t\t\t\tsource.height = height;\n\t\t\t}\n\n\t\t\t\/* Link to a specific URL on request. *\/\n\t\t\tif ( 'link' === data.message ) {\n\t\t\t\tsourceURL = document.createElement( 'a' );\n\t\t\t\ttargetURL = document.createElement( 'a' );\n\n\t\t\t\tsourceURL.href = source.getAttribute( 'src' );\n\t\t\t\ttargetURL.href = data.value;\n\n\t\t\t\t\/* Only follow link if the protocol is in the allow list. *\/\n\t\t\t\tif ( ! allowedProtocols.test( targetURL.protocol ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t\/* Only continue if link hostname matches iframe's hostname. *\/\n\t\t\t\tif ( targetURL.host === sourceURL.host ) {\n\t\t\t\t\tif ( document.activeElement === source ) {\n\t\t\t\t\t\twindow.top.location.href = data.value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tfunction onLoad() {\n\t\tif ( loaded ) {\n\t\t\treturn;\n\t\t}\n\n\t\tloaded = true;\n\n\t\tvar isIE10 = -1 !== navigator.appVersion.indexOf( 'MSIE 10' ),\n\t\t\tisIE11 = !!navigator.userAgent.match( \/Trident.*rv:11\\.\/ ),\n\t\t\tiframes = document.querySelectorAll( 'iframe.wp-embedded-content' ),\n\t\t\tiframeClone, i, source, secret;\n\n\t\tfor ( i = 0; i < iframes.length; i++ ) {\n\t\t\t\/** @var {IframeElement} *\/\n\t\t\tsource = iframes[ i ];\n\n\t\t\tsecret = source.getAttribute( 'data-secret' );\n\t\t\tif ( ! secret ) {\n\t\t\t\t\/* Add secret to iframe *\/\n\t\t\t\tsecret = Math.random().toString( 36 ).substr( 2, 10 );\n\t\t\t\tsource.src += '#?secret=' + secret;\n\t\t\t\tsource.setAttribute( 'data-secret', secret );\n\t\t\t}\n\n\t\t\t\/* Remove security attribute from iframes in IE10 and IE11. *\/\n\t\t\tif ( ( isIE10 || isIE11 ) ) {\n\t\t\t\tiframeClone = source.cloneNode( true );\n\t\t\t\tiframeClone.removeAttribute( 'security' );\n\t\t\t\tsource.parentNode.replaceChild( iframeClone, source );\n\t\t\t}\n\n\t\t\t\/*\n\t\t\t * Let post embed window know that the parent is ready for receiving the height message, in case the iframe\n\t\t\t * loaded before wp-embed.js was loaded. When the ready message is received by the post embed window, the\n\t\t\t * window will then (re-)send the height message right away.\n\t\t\t *\/\n\t\t\tsource.contentWindow.postMessage( {\n\t\t\t\tmessage: 'ready',\n\t\t\t\tsecret: secret\n\t\t\t}, '*' );\n\t\t}\n\t}\n\n\tif ( supportedBrowser ) {\n\t\twindow.addEventListener( 'message', window.wp.receiveEmbedMessage, false );\n\t\tdocument.addEventListener( 'DOMContentLoaded', onLoad, false );\n\t\twindow.addEventListener( 'load', onLoad, false );\n\t}\n})( window, document );\n<\/script>\n","thumbnail_url":"https:\/\/www.ping.fm\/howto\/wp-content\/uploads\/2024\/04\/How-Does-SSH-Public-Key-Authentication-Work-Chinese.jpg","thumbnail_width":1280,"thumbnail_height":731,"description":"SSH \u516c\u94a5\u8ba4\u8bc1\u662f\u5982\u4f55\u5de5\u4f5c\u7684\uff1f \u5b89\u5168\u5916\u58f3\uff08SSH\uff09\u516c\u94a5\u8ba4\u8bc1\u662f\u4e00\u79cd\u7ba1\u7406\u8bbe\u5907\u95f4\u5b89\u5168\u901a\u4fe1\u7684\u5f3a\u5927\u5de5\u5177\u3002\u5b83\u5229\u7528\u4e00\u5bf9\u52a0\u5bc6\u5bc6\u94a5\u5efa\u7acb\u7f51\u7edc\u8fde\u63a5\uff0c\u5728\u4e0d\u4ea4\u6362\u5bc6\u7801\u7684\u60c5\u51b5\u4e0b\u786e\u8ba4\u8eab\u4efd\u3002\u5f53\u6211\u5bfb\u627e\u4e00\u79cd\u6bd4\u57fa\u4e8e\u5bc6\u7801\u7684\u767b\u5f55\u66f4\u5b89\u5168\u7684\u66ff\u4ee3\u65b9\u6848\u4ee5\u8bbf\u95ee\u670d\u52a1\u5668\u65f6\uff0c\u6211\u5f00\u59cb\u4e86SSH\u516c\u94a5\u8ba4\u8bc1\u4e4b\u65c5\u3002\u501f\u9274\u4e2a\u4eba\u7ecf\u9a8c\uff0c\u6211\u5c06\u6307\u5bfc\u60a8\u4e86\u89e3\u8fd9\u79cd\u8ba4\u8bc1\u673a\u5236\u662f\u5982\u4f55\u5de5\u4f5c\u7684\uff0c\u5e76\u63d0\u4f9b\u5b9e\u7528\u6b65\u9aa4\uff0c\u8ba9\u60a8\u81ea\u5df1\u5b9e\u73b0\u5b83\u3002 1 \u5e38\u89c1\u573a\u666f\uff1a \u9700\u8981\u5b89\u5168\u8fdc\u7a0b\u8bbf\u95ee &#128737; \u7ecf\u5e38\u8bbf\u95ee\u8fdc\u7a0b\u670d\u52a1\u5668\uff0c\u9700\u8981\u907f\u514d\u4f7f\u7528\u5bc6\u7801\u6240\u5e26\u6765\u7684\u98ce\u9669\u3002 \u5e0c\u671b\u81ea\u52a8\u5316\u90a3\u4e9b\u65e0\u9700\u4eba\u5de5\u5e72\u9884\u7684\u4f7f\u7528SSH\u7684\u4efb\u52a1\uff0c\u5982\u811a\u672c\u6216\u6301\u7eed\u96c6\u6210\u7cfb\u7edf\u3002 \u7ef4\u62a4\u591a\u4e2a\u670d\u52a1\u5668\u4e14\u9700\u8981\u5728\u4e0d\u964d\u4f4e\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u7b80\u5316\u767b\u5f55\u6d41\u7a0b\u3002 \u81ea\u52a8\u5316\u90e8\u7f72\u548c\u64cd\u4f5c &#129302; \u5b9e\u65bd\u81ea\u52a8\u5316\u90e8\u7f72\u6d41\u7a0b\uff0c\u670d\u52a1\u5668\u5fc5\u987b\u4f7f\u7528\u50cfGit\u8fd9\u6837\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u8fdb\u884c\u8eab\u4efd\u9a8c\u8bc1\u3002 \u914d\u7f6eSSH\u5bc6\u94a5\uff0c\u4f7f\u81ea\u52a8\u5316\u5de5\u5177\u4e0e\u751f\u4ea7\u670d\u52a1\u5668\u4e4b\u95f4\u5efa\u7acb\u5b89\u5168\u8fde\u63a5\u3002 \u4fbf\u6377\u5730\u8fdb\u884c\u8fdc\u7a0b\u8bca\u65ad\u548c\u7ef4\u62a4\u64cd\u4f5c\uff0c\u6700\u5c0f\u5316\u624b\u52a8\u767b\u5f55\u9700\u6c42\u3002 \u589e\u5f3a\u4e2a\u4eba\u5b89\u5168\u59ff\u6001 &#128272; \u4e2a\u4eba\u503e\u5411\u4e8e\u5728\u7ba1\u7406SSH\u8fde\u63a5\u7684\u654f\u611f\u6570\u636e\u65f6\u91c7\u53d6\u66f4\u591a\u5b89\u5168\u63aa\u65bd\u3002 \u589e\u52a0\u5bf9\u9493\u9c7c\u653b\u51fb\u6216\u5bc6\u7801\u76d7\u7a83\u7684\u9632\u8303\u63aa\u65bd\u3002 \u901a\u8fc7\u6d88\u9664\u5bb9\u6613\u53d7\u5230\u66b4\u529b\u653b\u51fb\u7684\u5bc6\u7801\u8fd9\u4e00\u5f31\u70b9\uff0c\u51cf\u5c11\u653b\u51fb\u9014\u5f84\u3002 2 \u5206\u6b65\u6307\u5357\u3002SSH \u5bc6\u94a5\u8ba4\u8bc1\u5982\u4f55\u5de5\u4f5c\uff1a \u65b9\u6cd5 1: \u751f\u6210 SSH \u5bc6\u94a5\u5bf9 &#128736; \u4f7f\u7528\u50cf ssh-keygen \u8fd9\u6837\u7684\u547d\u4ee4\u521b\u5efa\u4e00\u4e2a\u5b89\u5168\u5916\u58f3\uff08SSH\uff09\u5bc6\u94a5\u5bf9\u3002 \u9009\u62e9\u6240\u9700\u7684\u5bc6\u94a5\u7b97\u6cd5\uff0cRSA \u6216 ED25519 \u662f\u6d41\u884c\u7684\u9009\u62e9\u3002 \u9009\u62e9\u4e00\u4e2a\u5b89\u5168\u7684\u77ed\u8bed\uff0c\u8fd9\u4e3a\u60a8\u7684\u5bc6\u94a5\u6dfb\u52a0\u4e86\u4e00\u4e2a\u989d\u5916\u7684\u5b89\u5168\u5c42\u3002 \u4fdd\u5b58\u751f\u6210\u7684\u516c\u94a5\u548c\u79c1\u94a5\u5230\u6307\u5b9a\u4f4d\u7f6e\u3002 \u521b\u5efa\u60a8\u79c1\u94a5\u7684\u5b89\u5168\u5907\u4efd\uff0c\u56e0\u4e3a\u5b83\u662f\u60a8\u7684\u8eab\u4efd\u8bc1\u660e\uff0c\u7edd\u4e0d\u5e94\u8be5\u5171\u4eab\u3002 \u6ce8\u610f\uff1a\u516c\u94a5\u53ef\u4ee5\u5171\u4eab\uff0c\u5e76\u7528\u4e8e\u60a8\u5e0c\u671b\u8bbf\u95ee\u7684\u670d\u52a1\u5668\u4e0a\uff0c\u800c\u79c1\u94a5\u4fdd\u7559\u5728\u60a8\u7684\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\uff0c\u7531\u77ed\u8bed\u4fdd\u62a4\u3002 \u65b9\u6cd5 2: \u5c06\u516c\u94a5\u590d\u5236\u5230\u670d\u52a1\u5668 &#128640; \u4f7f\u7528 ssh-copy-id\uff0c\u4e00\u4e2a\u5728\u670d\u52a1\u5668\u7684authorized_keys\u6587\u4ef6\u4e2d\u5b89\u88c5\u60a8\u516c\u94a5\u7684\u811a\u672c\u3002 \u6267\u884c ssh-copy-id user@hostname\uff0c\u63d2\u5165\u60a8\u7684\u7528\u6237\u540d\u548c\u60a8\u5e0c\u671b\u8bbf\u95ee\u7684\u4e3b\u673a\u3002 \u5728\u63d0\u793a\u65f6\u8f93\u5165\u60a8\u7684\u5bc6\u7801\uff0c\u4ee5\u5b8c\u6210\u590d\u5236\u8fc7\u7a0b\u3002 \u9a8c\u8bc1\u60a8\u7684\u516c\u94a5\u662f\u5426\u5df2\u901a\u8fc7\u624b\u52a8\u68c0\u67e5\u670d\u52a1\u5668\u4e0a\u7684 ~\/.ssh\/authorized_keys \u6587\u4ef6\u6b63\u786e\u6dfb\u52a0\u3002 \u6ce8\u610f\uff1a\u8fd9\u4e00\u6b65\u81f3\u5173\u91cd\u8981\uff0c\u56e0\u4e3a\u5b83\u5efa\u7acb\u4e86\u60a8\u7684\u5ba2\u6237\u7aef\u673a\u5668\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u4fe1\u4efb\u5173\u7cfb\uff0c\u4ee5\u7528\u4e8e\u672a\u6765\u7684\u8fde\u63a5\u3002 \u65b9\u6cd5 [&hellip;]"}