{"id":58027,"date":"2025-08-16T00:10:11","date_gmt":"2025-08-15T16:10:11","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/58027.html"},"modified":"2025-08-16T00:10:11","modified_gmt":"2025-08-15T16:10:11","slug":"linux-%e5%91%8a%e5%88%ab%e7%b9%81%e7%90%90%ef%bc%81%e8%a7%a3%e9%94%81-ssh-config-%e6%96%87%e4%bb%b6%e7%9a%84%e7%a5%9e%e4%bb%99%e7%94%a8%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/58027.html","title":{"rendered":"Linux: \u544a\u522b\u7e41\u7410\uff01\u89e3\u9501 SSH `config` \u6587\u4ef6\u7684\u795e\u4ed9\u7528\u6cd5"},"content":{"rendered":"<p>\u4f5c\u4e3a\u4e00\u540d\u8fd0\u7ef4\u5f00\u53d1\u5de5\u7a0b\u5e08&#xff0c;SSH \u51e0\u4e4e\u662f\u6211\u4eec\u6bcf\u5929\u90fd\u4f1a\u7528\u5230\u7684\u547d\u4ee4\u3002\u6211\u4eec\u7528\u5b83\u8fde\u63a5\u5230\u8fdc\u7a0b\u670d\u52a1\u5668&#xff0c;\u8fdb\u884c\u4ee3\u7801\u90e8\u7f72\u3001\u65e5\u5fd7\u67e5\u770b\u548c\u5404\u79cd\u7cfb\u7edf\u7ba1\u7406\u64cd\u4f5c\u3002\u4f46\u6211\u4eec\u662f\u5426\u8fd8\u5728\u624b\u52a8\u8f93\u5165\u957f\u957f\u7684 ssh \u547d\u4ee4&#xff0c;\u6bd4\u5982 ssh -p 2222 -i ~\/.ssh\/my_key user&#064;192.168.1.101&#xff1f;\u5982\u679c\u7ba1\u7406\u7740\u6570\u5341\u751a\u81f3\u4e0a\u767e\u53f0\u670d\u52a1\u5668&#xff0c;\u8fd9\u79cd\u91cd\u590d\u6027\u5de5\u4f5c\u4e0d\u4ec5\u6548\u7387\u4f4e\u4e0b&#xff0c;\u800c\u4e14\u5bb9\u6613\u51fa\u9519\u3002<\/p>\n<p>\u4eca\u5929&#xff0c;\u6211\u5c06\u5e26\u5927\u5bb6\u89e3\u9501 ~\/.ssh\/config \u8fd9\u4e2a\u5f3a\u5927\u7684\u914d\u7f6e\u6587\u4ef6\u3002\u901a\u8fc7\u7b80\u5355\u7684\u914d\u7f6e&#xff0c;\u6211\u4eec\u53ef\u4ee5\u5c06\u590d\u6742\u7684\u8fde\u63a5\u547d\u4ee4\u7b80\u5316\u4e3a ssh myserver&#xff0c;\u8fd8\u80fd\u5b9e\u73b0\u8df3\u677f\u673a&#xff08;\u5821\u5792\u673a&#xff09;\u4ee3\u7406\u3001\u8fde\u63a5\u590d\u7528\u7b49\u9ad8\u7ea7\u529f\u80fd&#xff0c;\u6781\u5927\u5730\u63d0\u5347\u6211\u4eec\u7684\u5de5\u4f5c\u6548\u7387\u548c\u5e78\u798f\u611f\u3002<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815161003-689f5bdb41ed9.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h4>\u8ba4\u8bc6 .ssh\/config \u6587\u4ef6<\/h4>\n<p>SSH \u5ba2\u6237\u7aef\u5728\u5c1d\u8bd5\u5efa\u7acb\u8fde\u63a5\u65f6&#xff0c;\u4f1a\u6309\u7167\u4ee5\u4e0b\u987a\u5e8f\u8bfb\u53d6\u914d\u7f6e\u4fe1\u606f&#xff1a;<\/p>\n<li>\u547d\u4ee4\u884c\u9009\u9879<\/li>\n<li>\u7528\u6237\u914d\u7f6e\u6587\u4ef6 ~\/.ssh\/config<\/li>\n<li>\u7cfb\u7edf\u7ea7\u914d\u7f6e\u6587\u4ef6 \/etc\/ssh\/ssh_config<\/li>\n<p>\u8fd9\u4e2a\u987a\u5e8f\u610f\u5473\u7740&#xff0c;\u7528\u6237\u81ea\u5b9a\u4e49\u7684 ~\/.ssh\/config \u6587\u4ef6\u4e2d\u7684\u914d\u7f6e\u4f1a\u8986\u76d6\u7cfb\u7edf\u7ea7\u7684\u9ed8\u8ba4\u914d\u7f6e&#xff0c;\u800c\u547d\u4ee4\u884c\u4e2d\u6307\u5b9a\u7684\u9009\u9879\u4f18\u5148\u7ea7\u6700\u9ad8\u3002<\/p>\n<p>\u914d\u7f6e\u6587\u4ef6\u7684\u57fa\u672c\u8bed\u6cd5\u975e\u5e38\u7b80\u5355&#xff0c;\u7531\u5173\u952e\u5b57\u548c\u53c2\u6570\u503c\u7ec4\u6210&#xff0c;\u53ef\u4ee5\u662f\u7528\u7a7a\u683c\u6216 &#061; \u5206\u9694\u3002 \u6587\u4ef6\u5185\u5bb9\u6309 Host \u5757\u8fdb\u884c\u7ec4\u7ec7&#xff0c;\u6bcf\u4e2a Host \u5757\u4e3a\u4e00\u4e2a\u6216\u591a\u4e2a\u4e3b\u673a\u5b9a\u4e49\u4e86\u4e00\u5957\u4e13\u5c5e\u7684\u914d\u7f6e\u3002<\/p>\n<p># \u8fd9\u662f\u4e00\u4e2a\u6ce8\u91ca<br \/>\nHost &lt;\u522b\u540d&gt;<br \/>\n    HostName &lt;\u5b9e\u9645\u4e3b\u673a\u540d\u6216IP&gt;<br \/>\n    User &lt;\u7528\u6237\u540d&gt;<br \/>\n    Port &lt;\u7aef\u53e3\u53f7&gt;<br \/>\n    # \u66f4\u591a\u914d\u7f6e&#8230;<\/p>\n<h4>\u57fa\u7840\u914d\u7f6e&#xff1a;\u5316\u7e41\u4e3a\u7b80\u7684\u827a\u672f<\/h4>\n<p>\u8ba9\u6211\u4eec\u4ece\u6700\u5e38\u89c1\u7684\u914d\u7f6e\u5f00\u59cb&#xff0c;\u770b\u770b\u5982\u4f55\u5c06\u5197\u957f\u7684\u547d\u4ee4\u53d8\u5f97\u4f18\u96c5\u3002<\/p>\n<h5>\u4e3a\u670d\u52a1\u5668\u8bbe\u7f6e\u522b\u540d<\/h5>\n<p>\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u53f0\u5f00\u53d1\u670d\u52a1\u5668&#xff0c;\u8fde\u63a5\u4fe1\u606f\u5982\u4e0b&#xff1a;<\/p>\n<ul>\n<li>IP\u5730\u5740: 198.51.100.1<\/li>\n<li>\u7528\u6237: dev<\/li>\n<li>\u7aef\u53e3: 10022<\/li>\n<li>\u79c1\u94a5: ~\/.ssh\/dev_key<\/li>\n<\/ul>\n<p>\u6bcf\u6b21\u8fde\u63a5\u90fd\u9700\u8981\u8f93\u5165&#xff1a;ssh -p 10022 -i ~\/.ssh\/dev_key dev&#064;198.51.100.1\u3002<\/p>\n<p>\u73b0\u5728&#xff0c;\u6211\u4eec\u53ef\u4ee5\u5728 ~\/.ssh\/config \u6587\u4ef6\u4e2d&#xff08;\u5982\u679c\u6587\u4ef6\u4e0d\u5b58\u5728&#xff0c;\u53ef\u4ee5\u624b\u52a8\u521b\u5efa&#xff09;\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e&#xff1a;<\/p>\n<p>Host dev-server<br \/>\n    HostName 198.51.100.1<br \/>\n    User dev<br \/>\n    Port 10022<br \/>\n    IdentityFile ~\/.ssh\/dev_key<\/p>\n<p>\u914d\u7f6e\u5b8c\u6210\u540e&#xff0c;\u8fde\u63a5\u670d\u52a1\u5668\u53ea\u9700\u8981\u4e00\u6761\u7b80\u5355\u7684\u547d\u4ee4&#xff1a;<\/p>\n<p><span class=\"token function\">ssh<\/span> dev-server<\/p>\n<p>\u662f\u4e0d\u662f\u77ac\u95f4\u6e05\u723d\u4e86\u5f88\u591a&#xff1f;<\/p>\n<h5>\u5e38\u7528\u57fa\u7840\u6307\u4ee4\u89e3\u6790<\/h5>\n<ul>\n<li>Host: \u5b9a\u4e49\u914d\u7f6e\u5757\u7684\u5f00\u59cb&#xff0c;\u540e\u9762\u8ddf\u7740\u4e00\u4e2a\u6216\u591a\u4e2a\u6a21\u5f0f&#xff08;\u522b\u540d&#xff09;\u3002\u53ef\u4ee5\u4f7f\u7528\u901a\u914d\u7b26&#xff0c;\u5982 * \u5339\u914d\u6240\u6709\u4e3b\u673a&#xff0c;? \u5339\u914d\u5355\u4e2a\u5b57\u7b26\u3002<\/li>\n<li>HostName: \u6307\u5b9a\u771f\u5b9e\u7684\u8fdc\u7a0b\u4e3b\u673a\u540d\u6216IP\u5730\u5740\u3002<\/li>\n<li>User: \u6307\u5b9a\u767b\u5f55\u7684\u7528\u6237\u540d\u3002<\/li>\n<li>Port: \u6307\u5b9a\u8fde\u63a5\u7684\u7aef\u53e3\u53f7&#xff0c;\u9ed8\u8ba4\u4e3a22\u3002<\/li>\n<li>IdentityFile: \u6307\u5b9a\u7528\u4e8e\u8eab\u4efd\u9a8c\u8bc1\u7684\u79c1\u94a5\u6587\u4ef6\u8def\u5f84\u3002\u53ef\u4ee5\u6307\u5b9a\u591a\u4e2a\u79c1\u94a5&#xff0c;SSH\u4f1a\u4f9d\u6b21\u5c1d\u8bd5\u3002<\/li>\n<li>IdentitiesOnly: \u8bbe\u4e3a yes \u65f6&#xff0c;SSH\u5ba2\u6237\u7aef\u5c06\u53ea\u4f7f\u7528 IdentityFile \u6307\u5b9a\u7684\u5bc6\u94a5\u8fdb\u884c\u8ba4\u8bc1&#xff0c;\u5373\u4f7f ssh-agent \u4e2d\u6709\u5176\u4ed6\u53ef\u7528\u7684\u5bc6\u94a5\u3002\u8fd9\u5728\u5bc6\u94a5\u8fc7\u591a\u5bfc\u81f4\u8ba4\u8bc1\u5931\u8d25\u65f6\u975e\u5e38\u6709\u7528\u3002<\/li>\n<\/ul>\n<h4>\u8fdb\u9636\u6280\u5de7&#xff1a;\u8fd0\u7ef4\u6548\u7387\u500d\u589e\u5668<\/h4>\n<p>\u638c\u63e1\u4e86\u57fa\u7840\u914d\u7f6e\u540e&#xff0c;\u6211\u4eec\u518d\u6765\u770b\u770b\u51e0\u4e2a\u80fd\u8ba9\u6211\u4eec\u6548\u7387\u7ffb\u500d\u7684\u8fdb\u9636\u6280\u5de7\u3002<\/p>\n<h5>\u6280\u5de7\u4e00&#xff1a;\u901a\u8fc7\u8df3\u677f\u673a&#xff08;Bastion Host&#xff09;\u65e0\u7f1d\u8fde\u63a5<\/h5>\n<p>\u5728\u8bb8\u591a\u751f\u4ea7\u73af\u5883\u4e2d&#xff0c;\u51fa\u4e8e\u5b89\u5168\u8003\u8651&#xff0c;\u6211\u4eec\u65e0\u6cd5\u76f4\u63a5\u8bbf\u95ee\u5185\u90e8\u670d\u52a1\u5668&#xff0c;\u5fc5\u987b\u5148\u767b\u5f55\u4e00\u53f0\u4f5c\u4e3a\u201c\u8df3\u677f\u673a\u201d\u6216\u201c\u5821\u5792\u673a\u201d\u7684\u670d\u52a1\u5668&#xff0c;\u518d\u4ece\u8df3\u677f\u673a\u8fde\u63a5\u5230\u76ee\u6807\u670d\u52a1\u5668\u3002 ProxyJump \u6307\u4ee4&#xff08;\u9700\u8981 OpenSSH 7.3&#043; \u7248\u672c&#xff09;\u8ba9\u8fd9\u4e2a\u8fc7\u7a0b\u53d8\u5f97\u5f02\u5e38\u7b80\u5355\u3002<\/p>\n<p>\u5047\u8bbe\u67b6\u6784\u5982\u4e0b&#xff1a;<\/p>\n<ul>\n<li>\u6211\u4eec\u7684\u672c\u5730\u673a\u5668 -&gt; \u8df3\u677f\u673a (bastion) -&gt; \u5185\u90e8\u670d\u52a1\u5668 (internal-app)<\/li>\n<\/ul>\n<p># \u8df3\u677f\u673a\u914d\u7f6e<br \/>\nHost bastion<br \/>\n    HostName bastion.example.com<br \/>\n    User jumpuser<br \/>\n    IdentityFile ~\/.ssh\/bastion_key<\/p>\n<p># \u5185\u90e8\u5e94\u7528\u670d\u52a1\u5668\u914d\u7f6e<br \/>\nHost internal-app<br \/>\n    HostName 10.0.1.10<br \/>\n    User app_admin<br \/>\n    ProxyJump bastion<br \/>\n    IdentityFile ~\/.ssh\/internal_key<\/p>\n<p>\u914d\u7f6e\u597d\u540e&#xff0c;\u6211\u4eec\u53ef\u4ee5\u4ece\u672c\u5730\u673a\u5668\u76f4\u63a5\u6267\u884c ssh internal-app&#xff0c;SSH \u5ba2\u6237\u7aef\u4f1a\u81ea\u52a8\u5148\u8fde\u63a5\u5230 bastion&#xff0c;\u7136\u540e\u901a\u8fc7\u5b83\u5efa\u7acb\u5230 internal-app \u7684\u96a7\u9053\u3002\u6574\u4e2a\u8fc7\u7a0b\u5bf9\u7528\u6237\u5b8c\u5168\u900f\u660e&#xff0c;\u5c31\u50cf\u76f4\u8fde\u4e00\u6837\u3002<\/p>\n<p>\u5bf9\u4e8e\u65e7\u7248\u672c\u7684 OpenSSH&#xff0c;\u53ef\u4ee5\u4f7f\u7528 ProxyCommand \u5b9e\u73b0\u7c7b\u4f3c\u529f\u80fd&#xff0c;\u4f46\u914d\u7f6e\u7a0d\u663e\u590d\u6742&#xff1a;<\/p>\n<p>Host internal-app<br \/>\n    HostName 10.0.1.10<br \/>\n    User app_admin<br \/>\n    ProxyCommand ssh bastion -W %h:%p<\/p>\n<p>\u4e0b\u9762\u662f ProxyJump \u5de5\u4f5c\u6d41\u7a0b\u7684\u793a\u610f\u56fe&#xff1a;<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815161009-689f5be1a74b7.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h5>\u6280\u5de7\u4e8c&#xff1a;\u4f7f\u7528 ControlMaster \u590d\u7528\u8fde\u63a5<\/h5>\n<p>\u5927\u5bb6\u662f\u5426\u9047\u5230\u8fc7\u8fd9\u6837\u7684\u573a\u666f&#xff1a;\u5df2\u7ecf\u8fde\u63a5\u5230\u4e00\u53f0\u670d\u52a1\u5668&#xff0c;\u9700\u8981\u518d\u5f00\u4e00\u4e2a\u7ec8\u7aef\u6267\u884c scp \u6216 rsync \u547d\u4ee4&#xff0c;\u7ed3\u679c\u53c8\u7ecf\u5386\u4e86\u4e00\u904d\u5b8c\u6574\u7684\u8ba4\u8bc1\u3001\u8fde\u63a5\u8fc7\u7a0b&#xff0c;\u5728\u7f51\u7edc\u4e0d\u4f73\u65f6\u5c24\u5176\u8017\u65f6\u3002<\/p>\n<p>ControlMaster \u529f\u80fd\u5141\u8bb8\u540e\u7eed\u7684 SSH \u8fde\u63a5\u5171\u4eab\u540c\u4e00\u4e2a\u5df2\u7ecf\u5efa\u7acb\u7684\u7f51\u7edc\u8fde\u63a5&#xff0c;\u4ece\u800c\u8df3\u8fc7\u63e1\u624b\u548c\u8ba4\u8bc1\u73af\u8282&#xff0c;\u5b9e\u73b0\u79d2\u5f00\u65b0\u4f1a\u8bdd\u3002<\/p>\n<p>\u5728 ~\/.ssh\/config \u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e&#xff0c;\u4e3a\u6240\u6709\u4e3b\u673a\u5f00\u542f\u8fde\u63a5\u590d\u7528&#xff1a;<\/p>\n<p>Host *<br \/>\n    ControlMaster auto<br \/>\n    ControlPath ~\/.ssh\/sockets\/%r&#064;%h:%p<br \/>\n    ControlPersist 10m<\/p>\n<ul>\n<li>ControlMaster auto: \u81ea\u52a8\u5f00\u542f\u6216\u4f7f\u7528\u5df2\u5b58\u5728\u7684\u4e3b\u8fde\u63a5\u3002<\/li>\n<li>ControlPath: \u6307\u5b9a\u7528\u4e8e\u901a\u4fe1\u7684 Unix socket \u6587\u4ef6\u8def\u5f84\u3002%r \u4ee3\u8868\u8fdc\u7a0b\u7528\u6237\u540d&#xff0c;%h \u4ee3\u8868\u4e3b\u673a\u540d&#xff0c;%p \u4ee3\u8868\u7aef\u53e3&#xff0c;\u786e\u4fdd\u6bcf\u4e2a\u8fde\u63a5\u90fd\u6709\u552f\u4e00\u7684 socket \u6587\u4ef6\u3002<\/li>\n<li>ControlPersist 10m: \u5373\u4f7f\u521d\u59cb\u7684 SSH \u4f1a\u8bdd\u5173\u95ed&#xff0c;\u4e3b\u8fde\u63a5\u4f9d\u7136\u5728\u540e\u53f0\u4fdd\u630110\u5206\u949f&#xff0c;\u65b9\u4fbf\u540e\u7eed\u8fde\u63a5\u590d\u7528\u3002<\/li>\n<\/ul>\n<p>\u73b0\u5728&#xff0c;\u5f53\u6211\u4eec\u7b2c\u4e00\u6b21 ssh \u5230\u67d0\u53f0\u670d\u52a1\u5668\u540e&#xff0c;\u53ef\u4ee5\u7acb\u5373\u6253\u5f00\u65b0\u7684\u7ec8\u7aef&#xff0c;\u518d\u6b21 ssh \u6216\u4f7f\u7528 scp&#xff0c;\u6211\u4eec\u4f1a\u53d1\u73b0\u8fde\u63a5\u77ac\u95f4\u5c31\u5efa\u7acb\u597d\u4e86&#xff0c;\u6781\u5927\u5730\u63d0\u5347\u4e86\u4ea4\u4e92\u4f53\u9a8c\u3002<\/p>\n<h5>\u6280\u5de7\u4e09&#xff1a;\u4fdd\u6301\u8fde\u63a5&#xff0c;\u544a\u522b\u201c\u6389\u7ebf\u201d<\/h5>\n<p>\u5728\u8fde\u63a5\u4e00\u4e9b\u4e0d\u6d3b\u8dc3\u7684\u670d\u52a1\u5668\u65f6&#xff0c;\u53ef\u80fd\u4f1a\u56e0\u4e3a\u4e2d\u95f4\u7f51\u7edc\u8bbe\u5907&#xff08;\u5982\u9632\u706b\u5899\u3001NAT&#xff09;\u7684\u8d85\u65f6\u7b56\u7565\u800c\u88ab\u65ad\u5f00\u8fde\u63a5\u3002\u901a\u8fc7\u8bbe\u7f6e\u5fc3\u8df3\u5305&#xff0c;\u53ef\u4ee5\u6709\u6548\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\u3002<\/p>\n<p>Host *<br \/>\n    ServerAliveInterval 60<br \/>\n    ServerAliveCountMax 3<\/p>\n<ul>\n<li>ServerAliveInterval 60: \u6bcf\u969460\u79d2&#xff0c;\u5ba2\u6237\u7aef\u4f1a\u5411\u670d\u52a1\u5668\u53d1\u9001\u4e00\u4e2a\u201c\u5fc3\u8df3\u201d\u6d88\u606f&#xff0c;\u8bf7\u6c42\u54cd\u5e94\u3002<\/li>\n<li>ServerAliveCountMax 3: \u5982\u679c\u5ba2\u6237\u7aef\u8fde\u7eed3\u6b21\u6ca1\u6709\u6536\u5230\u670d\u52a1\u5668\u7684\u54cd\u5e94&#xff0c;\u5219\u8ba4\u4e3a\u8fde\u63a5\u5df2\u65ad\u5f00\u3002<\/li>\n<\/ul>\n<h4>\u5b9e\u7528\u5efa\u8bae\u4e0e\u6700\u4f73\u5b9e\u8df5<\/h4>\n<li>\u5206\u5757\u7ec4\u7ec7\u4e0e\u901a\u914d\u7b26&#xff1a;\u5c06\u9488\u5bf9\u7279\u5b9a\u9879\u76ee\u6216\u73af\u5883\u7684\u914d\u7f6e\u653e\u5728\u4e00\u8d77\u3002\u4f7f\u7528 Host * \u5c06\u901a\u7528\u914d\u7f6e&#xff08;\u5982 ControlMaster\u3001ServerAliveInterval&#xff09;\u653e\u5728\u6587\u4ef6\u672b\u5c3e&#xff0c;\u8fd9\u6837\u53ef\u4ee5\u88ab\u524d\u9762\u7684\u7279\u5b9a\u914d\u7f6e\u8986\u76d6\u3002<\/li>\n<li>\u5b89\u5168\u7b2c\u4e00&#xff1a;\u4e0d\u8981\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u660e\u6587\u5b58\u50a8\u5bc6\u7801\u3002\u59cb\u7ec8\u4f18\u5148\u4f7f\u7528\u57fa\u4e8e\u5bc6\u94a5\u7684\u8ba4\u8bc1\u3002<\/li>\n<li>\u7248\u672c\u517c\u5bb9\u6027&#xff1a;ProxyJump \u662f\u73b0\u4ee3 OpenSSH \u7684\u4fbf\u5229\u529f\u80fd&#xff0c;\u4f46\u5728\u4e0e\u65e7\u7cfb\u7edf\u4ea4\u4e92\u65f6&#xff0c;ProxyCommand \u4ecd\u7136\u662f\u53ef\u9760\u7684\u5907\u9009\u65b9\u6848\u3002<\/li>\n<li>\u4fdd\u6301\u6574\u6d01&#xff1a;\u5b9a\u671f\u6e05\u7406\u4e0d\u518d\u4f7f\u7528\u7684\u914d\u7f6e&#xff0c;\u8ba9\u6211\u4eec\u7684 config \u6587\u4ef6\u4fdd\u6301\u6e05\u6670\u6613\u8bfb\u3002<\/li>\n<h4>\u7ed3\u8bba<\/h4>\n<p>~\/.ssh\/config \u6587\u4ef6\u8fdc\u4e0d\u6b62\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u522b\u540d\u5de5\u5177&#xff0c;\u5b83\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u6548\u7387\u653e\u5927\u5668\u3002\u901a\u8fc7\u638c\u63e1\u5b83\u7684\u914d\u7f6e\u6280\u5de7&#xff0c;\u65e0\u8bba\u662f\u7b80\u5316\u65e5\u5e38\u8fde\u63a5&#xff0c;\u8fd8\u662f\u5904\u7406\u590d\u6742\u7684\u7f51\u7edc\u73af\u5883&#xff0c;\u6211\u4eec\u90fd\u80fd\u6e38\u5203\u6709\u4f59\u3002\u82b1\u4e00\u70b9\u65f6\u95f4\u6765\u6574\u7406\u6211\u4eec\u7684 config \u6587\u4ef6&#xff0c;\u5b83\u5c06\u5728\u672a\u6765\u7684\u5de5\u4f5c\u4e2d\u4e3a\u6211\u4eec\u8282\u7701\u5927\u91cf\u7684\u65f6\u95f4\u548c\u7cbe\u529b\u3002<\/p>\n<p>\u73b0\u5728\u5c31\u6253\u5f00\u6211\u4eec\u7684\u7ec8\u7aef&#xff0c;\u5f00\u59cb\u6253\u9020\u5c5e\u4e8e\u6211\u4eec\u81ea\u5df1\u7684\u9ad8\u6548 SSH \u5de5\u4f5c\u6d41\u5427&#xff01;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb964\u6b21\uff0c\u70b9\u8d5e30\u6b21\uff0c\u6536\u85cf28\u6b21\u3002~\/.ssh\/config \u6587\u4ef6\u8fdc\u4e0d\u6b62\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u522b\u540d\u5de5\u5177\uff0c\u5b83\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u6548\u7387\u653e\u5927\u5668\u3002\u901a\u8fc7\u638c\u63e1\u5b83\u7684\u914d\u7f6e\u6280\u5de7\uff0c\u65e0\u8bba\u662f\u7b80\u5316\u65e5\u5e38\u8fde\u63a5\uff0c\u8fd8\u662f\u5904\u7406\u590d\u6742\u7684\u7f51\u7edc\u73af\u5883\uff0c\u6211\u4eec\u90fd\u80fd\u6e38\u5203\u6709\u4f59\u3002\u82b1\u4e00\u70b9\u65f6\u95f4\u6765\u6574\u7406\u6211\u4eec\u7684 config \u6587\u4ef6\uff0c\u5b83\u5c06\u5728\u672a\u6765\u7684\u5de5\u4f5c\u4e2d\u4e3a\u6211\u4eec\u8282\u7701\u5927\u91cf\u7684\u65f6\u95f4\u548c\u7cbe\u529b\u3002<\/p>\n","protected":false},"author":2,"featured_media":58025,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,77,6098,2758,44],"topic":[],"class_list":["post-58027","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-ssh","tag-2758","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux: \u544a\u522b\u7e41\u7410\uff01\u89e3\u9501 SSH `config` \u6587\u4ef6\u7684\u795e\u4ed9\u7528\u6cd5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/58027.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux: \u544a\u522b\u7e41\u7410\uff01\u89e3\u9501 SSH `config` \u6587\u4ef6\u7684\u795e\u4ed9\u7528\u6cd5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb964\u6b21\uff0c\u70b9\u8d5e30\u6b21\uff0c\u6536\u85cf28\u6b21\u3002~\/.ssh\/config \u6587\u4ef6\u8fdc\u4e0d\u6b62\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u522b\u540d\u5de5\u5177\uff0c\u5b83\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u6548\u7387\u653e\u5927\u5668\u3002\u901a\u8fc7\u638c\u63e1\u5b83\u7684\u914d\u7f6e\u6280\u5de7\uff0c\u65e0\u8bba\u662f\u7b80\u5316\u65e5\u5e38\u8fde\u63a5\uff0c\u8fd8\u662f\u5904\u7406\u590d\u6742\u7684\u7f51\u7edc\u73af\u5883\uff0c\u6211\u4eec\u90fd\u80fd\u6e38\u5203\u6709\u4f59\u3002\u82b1\u4e00\u70b9\u65f6\u95f4\u6765\u6574\u7406\u6211\u4eec\u7684 config \u6587\u4ef6\uff0c\u5b83\u5c06\u5728\u672a\u6765\u7684\u5de5\u4f5c\u4e2d\u4e3a\u6211\u4eec\u8282\u7701\u5927\u91cf\u7684\u65f6\u95f4\u548c\u7cbe\u529b\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/58027.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-15T16:10:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815161003-689f5bdb41ed9.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/58027.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/58027.html\",\"name\":\"Linux: \u544a\u522b\u7e41\u7410\uff01\u89e3\u9501 SSH `config` \u6587\u4ef6\u7684\u795e\u4ed9\u7528\u6cd5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-15T16:10:11+00:00\",\"dateModified\":\"2025-08-15T16:10:11+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/58027.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/58027.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/58027.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux: \u544a\u522b\u7e41\u7410\uff01\u89e3\u9501 SSH `config` \u6587\u4ef6\u7684\u795e\u4ed9\u7528\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux: \u544a\u522b\u7e41\u7410\uff01\u89e3\u9501 SSH `config` \u6587\u4ef6\u7684\u795e\u4ed9\u7528\u6cd5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/58027.html","og_locale":"zh_CN","og_type":"article","og_title":"Linux: \u544a\u522b\u7e41\u7410\uff01\u89e3\u9501 SSH `config` \u6587\u4ef6\u7684\u795e\u4ed9\u7528\u6cd5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb964\u6b21\uff0c\u70b9\u8d5e30\u6b21\uff0c\u6536\u85cf28\u6b21\u3002~\/.ssh\/config \u6587\u4ef6\u8fdc\u4e0d\u6b62\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u522b\u540d\u5de5\u5177\uff0c\u5b83\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u6548\u7387\u653e\u5927\u5668\u3002\u901a\u8fc7\u638c\u63e1\u5b83\u7684\u914d\u7f6e\u6280\u5de7\uff0c\u65e0\u8bba\u662f\u7b80\u5316\u65e5\u5e38\u8fde\u63a5\uff0c\u8fd8\u662f\u5904\u7406\u590d\u6742\u7684\u7f51\u7edc\u73af\u5883\uff0c\u6211\u4eec\u90fd\u80fd\u6e38\u5203\u6709\u4f59\u3002\u82b1\u4e00\u70b9\u65f6\u95f4\u6765\u6574\u7406\u6211\u4eec\u7684 config \u6587\u4ef6\uff0c\u5b83\u5c06\u5728\u672a\u6765\u7684\u5de5\u4f5c\u4e2d\u4e3a\u6211\u4eec\u8282\u7701\u5927\u91cf\u7684\u65f6\u95f4\u548c\u7cbe\u529b\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/58027.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-15T16:10:11+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815161003-689f5bdb41ed9.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/58027.html","url":"https:\/\/www.wsisp.com\/helps\/58027.html","name":"Linux: \u544a\u522b\u7e41\u7410\uff01\u89e3\u9501 SSH `config` \u6587\u4ef6\u7684\u795e\u4ed9\u7528\u6cd5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-15T16:10:11+00:00","dateModified":"2025-08-15T16:10:11+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/58027.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/58027.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/58027.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Linux: \u544a\u522b\u7e41\u7410\uff01\u89e3\u9501 SSH `config` \u6587\u4ef6\u7684\u795e\u4ed9\u7528\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/58027","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=58027"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/58027\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/58025"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=58027"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=58027"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=58027"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=58027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}