{"id":62642,"date":"2025-04-29T12:27:23","date_gmt":"2025-04-29T04:27:23","guid":{"rendered":"https:\/\/fwq.ai\/blog\/62642\/"},"modified":"2025-04-29T12:27:23","modified_gmt":"2025-04-29T04:27:23","slug":"%e6%95%99%e4%bd%a0%e5%9c%a8linux-sysops%e4%b8%ad%e4%bd%bf%e7%94%a8ssh%e8%bf%9b%e8%a1%8c%e6%96%87%e4%bb%b6%e4%bc%a0%e8%be%93-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/62642\/","title":{"rendered":"\u6559\u4f60\u5728Linux SysOps\u4e2d\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/887\/227\/169571513520606.jpg\" class=\"aligncenter\" title=\"\u6559\u4f60\u5728Linux SysOps\u4e2d\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u63d2\u56fe\" alt=\"\u6559\u4f60\u5728Linux SysOps\u4e2d\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u63d2\u56fe\" \/><\/p>\n<p>\u6559\u4f60\u5728Linux SysOps\u4e2d\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\uff0c\u9700\u8981\u5177\u4f53\u4ee3\u7801\u793a\u4f8b<\/p>\n<p>SSH\uff08Secure Shell\uff09\u662f\u4e00\u79cd\u52a0\u5bc6\u7684\u8fdc\u7a0b\u767b\u5f55\u534f\u8bae\uff0c\u5b83\u4e0d\u4ec5\u53ef\u4ee5\u7528\u4e8e\u8fdc\u7a0b\u767b\u5f55\u64cd\u4f5c\u7cfb\u7edf\uff0c\u8fd8\u53ef\u4ee5\u7528\u4e8e\u5728\u4e0d\u540c\u7684\u4e3b\u673a\u4e4b\u95f4\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u3002\u5728Linux SysOps\u5de5\u4f5c\u4e2d\uff0c\u7ecf\u5e38\u9700\u8981\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\uff0c\u8fd9\u7bc7\u6587\u7ae0\u5c06\u4e3a\u4f60\u63d0\u4f9b\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u6559\u4f60\u5982\u4f55\u5728Linux\u73af\u5883\u4e2d\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u3002<\/p>\n<p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u4e0a\u5df2\u7ecf\u5b89\u88c5\u4e86OpenSSH\u8f6f\u4ef6\u5305\uff0c\u5b83\u63d0\u4f9b\u4e86SSH\u534f\u8bae\u7684\u5b9e\u73b0\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5OpenSSH\u662f\u5426\u5df2\u5b89\u88c5\uff1a<\/p>\n<pre>$ ssh -V<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5982\u679c\u4f60\u770b\u5230\u7c7b\u4f3c\u4e8e\u4ee5\u4e0b\u8f93\u51fa\uff0c\u5219\u8bf4\u660eOpenSSH\u5df2\u7ecf\u5b89\u88c5\u4e86\uff1a<\/p>\n<pre>OpenSSH_7.9p1, OpenSSL 1.1.1g  21 Apr 2020<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5982\u679cOpenSSH\u6ca1\u6709\u5b89\u88c5\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5\uff1a<\/p>\n<pre>$ sudo apt-get update\n$ sudo apt-get install openssh-server<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4e00\u65e6OpenSSH\u5b89\u88c5\u5b8c\u6210\uff0c\u4f60\u5c31\u53ef\u4ee5\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u4e86\u3002\u4e0b\u9762\u662f\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u7684\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<ol>\n<li>\u4ece\u672c\u5730\u4e3b\u673a\u4f20\u8f93\u6587\u4ef6\u5230\u8fdc\u7a0b\u4e3b\u673a<\/li>\n<\/ol>\n<pre>$ scp \/path\/to\/local\/file username@remote_host:\/path\/to\/remote\/directory<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u5c06\u672c\u5730\u4e3b\u673a\u7684\/path\/to\/local\/file\u6587\u4ef6\u4f20\u8f93\u5230\u8fdc\u7a0b\u4e3b\u673a\u7684\/path\/to\/remote\/directory\u76ee\u5f55\u4e0b\u3002\u4f60\u9700\u8981\u5c06username\u548cremote_host\u66ff\u6362\u4e3a\u8fdc\u7a0b\u4e3b\u673a\u7684\u7528\u6237\u540d\u548c\u4e3b\u673a\u540d\u3002<\/p>\n<ol>\n<li>\u4ece\u8fdc\u7a0b\u4e3b\u673a\u4f20\u8f93\u6587\u4ef6\u5230\u672c\u5730\u4e3b\u673a<\/li>\n<\/ol>\n<pre>$ scp username@remote_host:\/path\/to\/remote\/file \/path\/to\/local\/directory<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u5c06\u8fdc\u7a0b\u4e3b\u673a\u7684\/path\/to\/remote\/file\u6587\u4ef6\u4f20\u8f93\u5230\u672c\u5730\u4e3b\u673a\u7684\/path\/to\/local\/directory\u76ee\u5f55\u4e0b\u3002\u540c\u6837\uff0c\u4f60\u9700\u8981\u5c06username\u548cremote_host\u66ff\u6362\u4e3a\u8fdc\u7a0b\u4e3b\u673a\u7684\u7528\u6237\u540d\u548c\u4e3b\u673a\u540d\u3002<\/p>\n<ol>\n<li>\u5728\u4e24\u4e2a\u8fdc\u7a0b\u4e3b\u673a\u4e4b\u95f4\u4f20\u8f93\u6587\u4ef6<\/li>\n<\/ol>\n<pre>$ scp username@remote_host1:\/path\/to\/remote\/file username@remote_host2:\/path\/to\/remote\/directory<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u5c06\u8fdc\u7a0b\u4e3b\u673a1\u7684\/path\/to\/remote\/file\u6587\u4ef6\u4f20\u8f93\u5230\u8fdc\u7a0b\u4e3b\u673a2\u7684\/path\/to\/remote\/directory\u76ee\u5f55\u4e0b\u3002\u4f60\u9700\u8981\u5c06username\u548cremote_host1\u3001remote_host2\u66ff\u6362\u4e3a\u5bf9\u5e94\u7684\u7528\u6237\u540d\u548c\u4e3b\u673a\u540d\u3002<\/p>\n<p>\u8fd9\u4e9b\u793a\u4f8b\u4e2d\u7684scp\u547d\u4ee4\u662f\u57fa\u4e8eSSH\u534f\u8bae\u7684\u3002\u5b83\u4f7f\u7528\u4e86\u4e0eSSH\u76f8\u540c\u7684\u8eab\u4efd\u9a8c\u8bc1\u548c\u52a0\u5bc6\u673a\u5236\uff0c\u56e0\u6b64\u5728\u6587\u4ef6\u4f20\u8f93\u8fc7\u7a0b\u4e2d\u80fd\u591f\u4fdd\u8bc1\u6570\u636e\u7684\u5b89\u5168\u6027\u3002<\/p>\n<p>\u9664\u4e86scp\u547d\u4ee4\u5916\uff0c\u4f60\u8fd8\u53ef\u4ee5\u4f7f\u7528rsync\u547d\u4ee4\u8fdb\u884c\u6587\u4ef6\u540c\u6b65\u3002rsync\u4e5f\u662f\u57fa\u4e8eSSH\u534f\u8bae\u7684\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u6709\u6548\u5730\u8fdb\u884c\u589e\u91cf\u540c\u6b65\uff0c\u53ea\u4f20\u8f93\u6587\u4ef6\u7684\u53d8\u5316\u90e8\u5206\uff0c\u63d0\u9ad8\u4e86\u6587\u4ef6\u4f20\u8f93\u7684\u6548\u7387\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u4f7f\u7528rsync\u8fdb\u884c\u6587\u4ef6\u540c\u6b65\u7684\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<pre>$ rsync -avz --progress \/path\/to\/local\/directory username@remote_host:\/path\/to\/remote\/directory<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u5c06\u672c\u5730\u4e3b\u673a\u7684\/path\/to\/local\/directory\u76ee\u5f55\u540c\u6b65\u5230\u8fdc\u7a0b\u4e3b\u673a\u7684\/path\/to\/remote\/directory\u76ee\u5f55\u4e0b\u3002\u540c\u6837\uff0c\u4f60\u9700\u8981\u5c06username\u548cremote_host\u66ff\u6362\u4e3a\u8fdc\u7a0b\u4e3b\u673a\u7684\u7528\u6237\u540d\u548c\u4e3b\u673a\u540d\u3002<\/p>\n<p>\u672c\u6587\u63d0\u4f9b\u4e86\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u7684\u5177\u4f53\u4ee3\u7801\u793a\u4f8b\uff0c\u5e0c\u671b\u5bf9\u4f60\u5728Linux SysOps\u5de5\u4f5c\u4e2d\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u6709\u6240\u5e2e\u52a9\u3002\u65e0\u8bba\u662f\u4ece\u672c\u5730\u4e3b\u673a\u4f20\u8f93\u6587\u4ef6\u5230\u8fdc\u7a0b\u4e3b\u673a\uff0c\u8fd8\u662f\u5728\u8fdc\u7a0b\u4e3b\u673a\u4e4b\u95f4\u4f20\u8f93\u6587\u4ef6\uff0cSSH\u90fd\u662f\u4e00\u4e2a\u5b89\u5168\u53ef\u9760\u7684\u9009\u62e9\u3002\u901a\u8fc7\u638c\u63e1\u8fd9\u4e9b\u6280\u5de7\uff0c\u4f60\u53ef\u4ee5\u66f4\u9ad8\u6548\u5730\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\uff0c\u5e76\u786e\u4fdd\u6570\u636e\u7684\u5b89\u5168\u6027\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u6559\u4f60\u5728Linux SysOps\u4e2d\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6559\u4f60\u5728Linux SysOps\u4e2d\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\uff0c\u9700\u8981\u5177\u4f53\u4ee3\u7801\u793a\u4f8b SSH\uff08Secure Shell\uff09\u662f\u4e00\u79cd\u52a0\u5bc6\u7684\u8fdc\u7a0b\u767b\u5f55\u534f\u8bae\uff0c\u5b83\u4e0d\u4ec5\u53ef\u4ee5\u7528\u4e8e\u8fdc\u7a0b\u767b\u5f55\u64cd\u4f5c\u7cfb\u7edf\uff0c\u8fd8\u53ef\u4ee5\u7528\u4e8e\u5728\u4e0d\u540c\u7684\u4e3b\u673a\u4e4b\u95f4\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u3002\u5728Linux SysOps\u5de5\u4f5c\u4e2d\uff0c\u7ecf\u5e38\u9700\u8981\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\uff0c\u8fd9\u7bc7\u6587\u7ae0\u5c06\u4e3a\u4f60\u63d0\u4f9b\u5177\u4f53\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u6559\u4f60\u5982\u4f55\u5728Linux\u73af\u5883\u4e2d\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u3002 \u9996\u5148\uff0c\u4f60\u9700\u8981\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u4e0a\u5df2\u7ecf\u5b89\u88c5\u4e86OpenSSH\u8f6f\u4ef6\u5305\uff0c\u5b83\u63d0\u4f9b\u4e86SSH\u534f\u8bae\u7684\u5b9e\u73b0\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5OpenSSH\u662f\u5426\u5df2\u5b89\u88c5\uff1a $ ssh -V \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u4f60\u770b\u5230\u7c7b\u4f3c\u4e8e\u4ee5\u4e0b\u8f93\u51fa\uff0c\u5219\u8bf4\u660eOpenSSH\u5df2\u7ecf\u5b89\u88c5\u4e86\uff1a OpenSSH_7.9p1, OpenSSL 1.1.1g 21 Apr 2020 \u767b\u5f55\u540e\u590d\u5236 \u5982\u679cOpenSSH\u6ca1\u6709\u5b89\u88c5\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5\uff1a $ sudo apt-get update $ sudo apt-get install openssh-server \u767b\u5f55\u540e\u590d\u5236 \u4e00\u65e6OpenSSH\u5b89\u88c5\u5b8c\u6210\uff0c\u4f60\u5c31\u53ef\u4ee5\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u4e86\u3002\u4e0b\u9762\u662f\u4f7f\u7528SSH\u8fdb\u884c\u6587\u4ef6\u4f20\u8f93\u7684\u4ee3\u7801\u793a\u4f8b\uff1a \u4ece\u672c\u5730\u4e3b\u673a\u4f20\u8f93\u6587\u4ef6\u5230\u8fdc\u7a0b\u4e3b\u673a $ scp \/path\/to\/local\/file username@remote_host:\/path\/to\/remote\/directory \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u4e2a\u547d\u4ee4\u5c06\u672c\u5730\u4e3b\u673a\u7684\/path\/to\/local\/file\u6587\u4ef6\u4f20\u8f93\u5230\u8fdc\u7a0b\u4e3b\u673a\u7684\/path\/to\/remote\/directory\u76ee\u5f55\u4e0b\u3002\u4f60\u9700\u8981\u5c06username\u548cremote_host\u66ff\u6362\u4e3a\u8fdc\u7a0b\u4e3b\u673a\u7684\u7528\u6237\u540d\u548c\u4e3b\u673a\u540d\u3002 \u4ece\u8fdc\u7a0b\u4e3b\u673a\u4f20\u8f93\u6587\u4ef6\u5230\u672c\u5730\u4e3b\u673a $ scp username@remote_host:\/path\/to\/remote\/file \/path\/to\/local\/directory \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u4e2a\u547d\u4ee4\u5c06\u8fdc\u7a0b\u4e3b\u673a\u7684\/path\/to\/remote\/file\u6587\u4ef6\u4f20\u8f93\u5230\u672c\u5730\u4e3b\u673a\u7684\/path\/to\/local\/directory\u76ee\u5f55\u4e0b\u3002\u540c\u6837\uff0c\u4f60\u9700\u8981\u5c06username\u548cremote_host\u66ff\u6362\u4e3a\u8fdc\u7a0b\u4e3b\u673a\u7684\u7528\u6237\u540d\u548c\u4e3b\u673a\u540d\u3002 \u5728\u4e24\u4e2a\u8fdc\u7a0b\u4e3b\u673a\u4e4b\u95f4\u4f20\u8f93\u6587\u4ef6 $ scp username@remote_host1:\/path\/to\/remote\/file username@remote_host2:\/path\/to\/remote\/directory \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u4e2a\u547d\u4ee4\u5c06\u8fdc\u7a0b\u4e3b\u673a1\u7684\/path\/to\/remote\/file\u6587\u4ef6\u4f20\u8f93\u5230\u8fdc\u7a0b\u4e3b\u673a2\u7684\/path\/to\/remote\/directory\u76ee\u5f55\u4e0b\u3002\u4f60\u9700\u8981\u5c06username\u548cremote_host1\u3001remote_host2\u66ff\u6362\u4e3a\u5bf9\u5e94\u7684\u7528\u6237\u540d\u548c\u4e3b\u673a\u540d\u3002 \u8fd9\u4e9b\u793a\u4f8b\u4e2d\u7684scp\u547d\u4ee4\u662f\u57fa\u4e8eSSH\u534f\u8bae\u7684\u3002\u5b83\u4f7f\u7528\u4e86\u4e0eSSH\u76f8\u540c\u7684\u8eab\u4efd\u9a8c\u8bc1\u548c\u52a0\u5bc6\u673a\u5236\uff0c\u56e0\u6b64\u5728\u6587\u4ef6\u4f20\u8f93\u8fc7\u7a0b\u4e2d\u80fd\u591f\u4fdd\u8bc1\u6570\u636e\u7684\u5b89\u5168\u6027\u3002 \u9664\u4e86scp\u547d\u4ee4\u5916\uff0c\u4f60\u8fd8\u53ef\u4ee5\u4f7f\u7528rsync\u547d\u4ee4\u8fdb\u884c\u6587\u4ef6\u540c\u6b65\u3002rsync\u4e5f\u662f\u57fa\u4e8eSSH\u534f\u8bae\u7684\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u6709\u6548\u5730\u8fdb\u884c\u589e\u91cf\u540c\u6b65\uff0c\u53ea\u4f20\u8f93\u6587\u4ef6\u7684\u53d8\u5316\u90e8\u5206\uff0c\u63d0\u9ad8\u4e86\u6587\u4ef6\u4f20\u8f93\u7684\u6548\u7387\u3002 \u4e0b\u9762\u662f\u4f7f\u7528rsync\u8fdb\u884c\u6587\u4ef6\u540c\u6b65\u7684\u4ee3\u7801\u793a\u4f8b\uff1a $ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-62642","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/62642","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=62642"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/62642\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=62642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=62642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=62642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}