{"id":47288,"date":"2025-07-30T07:13:00","date_gmt":"2025-07-29T23:13:00","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/47288.html"},"modified":"2025-07-30T07:13:00","modified_gmt":"2025-07-29T23:13:00","slug":"%e4%b8%89%e6%ad%a5%e6%90%9e%e5%ae%9a%ef%bc%81%e8%ae%a9%e4%bd%a0%e7%9a%84-wsl2-%e5%8f%98%e8%ba%ab%e5%b1%80%e5%9f%9f%e7%bd%91%e5%86%85%e7%9a%84-ssh-%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/47288.html","title":{"rendered":"\u4e09\u6b65\u641e\u5b9a\uff01\u8ba9\u4f60\u7684 WSL2 \u53d8\u8eab\u5c40\u57df\u7f51\u5185\u7684 SSH \u670d\u52a1\u5668"},"content":{"rendered":"<p>                       \u5c40\u57df\u7f51\u5185\u7684\u5176\u4ed6\u7535\u8111\u901a\u8fc7 SSH \u8fde\u63a5\u5230\u4f60 Windows 11 \u4e0a\u7684 WSL (Ubuntu)&#xff0c;\u8fd9\u4e2a\u9700\u6c42\u975e\u5e38\u5b9e\u7528\u3002\u8fd9\u6bd4\u9ed8\u8ba4\u7684\u672c\u673a\u8fde\u63a5\u8981\u590d\u6742\u4e00\u4e9b&#xff0c;\u56e0\u4e3a\u6d89\u53ca\u5230**\u7aef\u53e3\u8f6c\u53d1**\u548c**\u9632\u706b\u5899\u8bbe\u7f6e**\u3002<\/p>\n<p>\u6574\u4e2a\u8fc7\u7a0b\u53ef\u4ee5\u5206\u4e3a\u4e09\u4e2a\u4e3b\u8981\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u5728 WSL (Ubuntu) \u4e2d\u914d\u7f6e\u548c\u8fd0\u884c SSH \u670d\u52a1\u3002<\/li>\n<li>\u5728 Windows \u4e2d\u8bbe\u7f6e\u7aef\u53e3\u8f6c\u53d1&#xff0c;\u5c06\u5916\u90e8\u8bf7\u6c42\u8f6c\u53d1\u5230 WSL\u3002<\/li>\n<li>\u5728 Windows \u9632\u706b\u5899\u4e2d\u6dfb\u52a0\u5165\u7ad9\u89c4\u5219&#xff0c;\u5141\u8bb8\u5916\u90e8\u8bbf\u95ee\u3002<\/li>\n<p>\u4e0b\u9762\u662f\u8be6\u7ec6\u7684\u64cd\u4f5c\u6307\u5357\u3002<\/p>\n<hr \/>\n<h4>\u7b2c1\u6b65&#xff1a;\u5728 WSL (Ubuntu) \u4e2d\u914d\u7f6e\u548c\u8fd0\u884c SSH<\/h4>\n<p>\u8fd9\u4e00\u6b65\u548c\u4e4b\u524d\u6211\u4eec\u8ba8\u8bba\u7684\u7c7b\u4f3c&#xff0c;\u4f46\u8981\u786e\u4fdd\u914d\u7f6e\u80fd\u63a5\u53d7\u5916\u90e8\u8fde\u63a5\u3002<\/p>\n<li>\n<p>\u5b89\u88c5 OpenSSH Server<br \/>\n\u5982\u679c\u4f60\u7684 WSL \u4e2d\u8fd8\u6ca1\u6709\u5b89\u88c5 SSH \u670d\u52a1&#xff0c;\u5148\u5b89\u88c5\u5b83\u3002\u6253\u5f00 WSL \u7ec8\u7aef&#xff1a;<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> update<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> <span class=\"token function\">install<\/span> openssh-server<\/p>\n<\/li>\n<li>\n<p>\u914d\u7f6e SSH \u670d\u52a1<br \/>\n\u7f16\u8f91 SSH \u914d\u7f6e\u6587\u4ef6&#xff0c;\u786e\u4fdd\u5b83\u5141\u8bb8\u5bc6\u7801\u767b\u5f55\u5e76\u4e14\u76d1\u542c\u5728\u6b63\u786e\u7684\u7aef\u53e3\u3002<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">nano<\/span> \/etc\/ssh\/sshd_config<\/p>\n<p>\u5728\u7f16\u8f91\u5668\u4e2d&#xff0c;\u627e\u5230\u5e76\u786e\u8ba4&#xff08;\u6216\u4fee\u6539&#xff09;\u4ee5\u4e0b\u51e0\u884c&#xff1a;<\/p>\n<p># \u786e\u4fdd\u76d1\u542c\u5728\u6240\u6709\u7f51\u7edc\u63a5\u53e3\u4e0a&#xff0c;\u8fd9\u662f\u9ed8\u8ba4\u503c&#xff0c;\u901a\u5e38\u4e0d\u7528\u6539<br \/>\n# ListenAddress 0.0.0.0<\/p>\n<p># \u4f60\u53ef\u4ee5\u81ea\u5b9a\u4e49\u7aef\u53e3&#xff0c;\u4e5f\u53ef\u4ee5\u4f7f\u7528\u9ed8\u8ba4\u7684 22 \u7aef\u53e3\u3002\u8fd9\u91cc\u4ee5 22 \u4e3a\u4f8b\u3002<br \/>\n# \u5982\u679c\u4f60\u60f3\u7528\u5176\u4ed6\u7aef\u53e3&#xff0c;\u6bd4\u5982 2222&#xff0c;\u5c31\u5199 Port 2222<br \/>\nPort 22<\/p>\n<p># \u4e3a\u4e86\u65b9\u4fbf&#xff0c;\u5148\u5141\u8bb8\u5bc6\u7801\u767b\u5f55<br \/>\nPasswordAuthentication yes<\/p>\n<p># &#xff08;\u53ef\u9009&#xff09;\u5982\u679c\u4f60\u4e0d\u60f3\u6bcf\u6b21\u90fd\u8f93\u5165 sudo \u542f\u52a8\u670d\u52a1&#xff0c;\u53ef\u4ee5\u4fee\u6539\u6b64\u9879<br \/>\n# UsePrivilegeSeparation no # \u8bbe\u4e3a no \u53ef\u80fd\u964d\u4f4e\u5b89\u5168\u6027&#xff0c;\u4f46\u80fd\u907f\u514d\u4e00\u4e9b\u6743\u9650\u95ee\u9898<\/p>\n<p>\u6309 Ctrl &#043; X&#xff0c;\u7136\u540e\u6309 Y \u548c Enter \u4fdd\u5b58\u5e76\u9000\u51fa\u3002<\/p>\n<\/li>\n<li>\n<p>\u542f\u52a8 SSH \u670d\u52a1<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">service<\/span> <span class=\"token function\">ssh<\/span> start<\/p>\n<p>\u4f60\u53ef\u4ee5\u68c0\u67e5\u4e00\u4e0b\u72b6\u6001&#xff0c;\u786e\u4fdd\u5b83\u6b63\u5728\u8fd0\u884c&#xff1a;<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">service<\/span> <span class=\"token function\">ssh<\/span> status<\/p>\n<p>\u5982\u679c\u770b\u5230 * sshd is running \u6216 Active: active (running) \u5c31\u8868\u793a\u6210\u529f\u4e86\u3002<\/p>\n<\/li>\n<li>\n<p>\u83b7\u53d6 WSL \u7684 IP \u5730\u5740<br \/>\n\u8fd9\u4e2a IP \u5730\u5740\u540e\u9762\u4f1a\u7528\u5230\u3002\u5728 WSL \u7ec8\u7aef\u4e2d\u8fd0\u884c&#xff1a;<\/p>\n<p><span class=\"token function\">ip<\/span> a <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> <span class=\"token string\">&#034;inet .* scope global&#034;<\/span><\/p>\n<p>\u4f60\u4f1a\u770b\u5230\u7c7b\u4f3c inet 172.21.123.45\/20 &#8230; \u8fd9\u6837\u7684\u8f93\u51fa&#xff0c;\u8bb0\u4e0b\u8fd9\u4e2a IP \u5730\u5740&#xff08;\u4f8b\u5982 172.21.123.45&#xff09;\u3002<\/p>\n<\/li>\n<hr \/>\n<h4>\u7b2c2\u6b65&#xff1a;\u5728 Windows \u4e2d\u8bbe\u7f6e\u7aef\u53e3\u8f6c\u53d1<\/h4>\n<p>\u8fd9\u662f\u6700\u5173\u952e\u7684\u4e00\u6b65\u3002WSL2 \u8fd0\u884c\u5728\u4e00\u4e2a\u865a\u62df\u7f51\u7edc\u4e2d&#xff0c;\u5c40\u57df\u7f51\u5185\u7684\u5176\u4ed6\u7535\u8111\u65e0\u6cd5\u76f4\u63a5\u8bbf\u95ee\u5230 WSL \u7684 IP\u3002\u6211\u4eec\u9700\u8981\u5728 Windows \u4e3b\u673a\u4e0a\u521b\u5efa\u4e00\u4e2a\u7aef\u53e3\u8f6c\u53d1\u89c4\u5219&#xff0c;\u5c06\u53d1\u5f80 Windows \u4e3b\u673a\u67d0\u4e2a\u7aef\u53e3\u7684\u6d41\u91cf&#xff0c;\u8f6c\u53d1\u7ed9 WSL \u7684 SSH \u7aef\u53e3\u3002<\/p>\n<li>\n<p>\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u6253\u5f00 PowerShell<\/p>\n<ul>\n<li>\u5728\u5f00\u59cb\u83dc\u5355\u4e0a\u53f3\u952e\u70b9\u51fb&#xff0c;\u9009\u62e9 \u201c\u7ec8\u7aef (\u7ba1\u7406\u5458)\u201d \u6216 \u201cWindows PowerShell (\u7ba1\u7406\u5458)\u201d\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u6267\u884c\u7aef\u53e3\u8f6c\u53d1\u547d\u4ee4<br \/>\n\u6211\u4eec\u5c06\u4f7f\u7528 netsh \u547d\u4ee4\u6765\u521b\u5efa\u8f6c\u53d1\u89c4\u5219\u3002\u547d\u4ee4\u7684\u683c\u5f0f\u662f&#xff1a;<br \/>\nnetsh interface portproxy add v4tov4 listenport&#061;&lt;Win\u7aef\u53e3&gt; listenaddress&#061;&lt;WinIP&gt; connectport&#061;&lt;WSL\u7aef\u53e3&gt; connectaddress&#061;&lt;WSL-IP&gt;<\/p>\n<ul>\n<li>listenport: \u4f60\u5e0c\u671b\u5c40\u57df\u7f51\u5176\u4ed6\u7535\u8111\u8bbf\u95ee\u7684 Windows \u7aef\u53e3&#xff08;\u4f8b\u5982 2222&#xff09;\u3002<\/li>\n<li>listenaddress: \u4f60\u7684 Windows \u4e3b\u673a\u5728\u5c40\u57df\u7f51\u4e2d\u7684 IP \u5730\u5740\u3002\u4f60\u53ef\u4ee5\u5728 PowerShell \u4e2d\u7528 ipconfig \u547d\u4ee4\u627e\u5230\u5b83&#xff08;\u901a\u5e38\u662f 192.168.x.x&#xff09;\u3002\u4e3a\u4e86\u65b9\u4fbf&#xff0c;\u4e5f\u53ef\u4ee5\u7528 0.0.0.0 \u8868\u793a\u76d1\u542c\u6240\u6709\u7f51\u7edc\u63a5\u53e3\u3002<\/li>\n<li>connectport: \u4f60\u5728 WSL \u4e2d\u914d\u7f6e\u7684 SSH \u7aef\u53e3&#xff08;\u4f8b\u5982 22&#xff09;\u3002<\/li>\n<li>connectaddress: \u4f60\u5728\u7b2c1\u6b65\u4e2d\u83b7\u53d6\u5230\u7684 WSL \u7684 IP \u5730\u5740&#xff08;\u4f8b\u5982 172.21.123.45&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u793a\u4f8b\u547d\u4ee4&#xff1a;<br \/>\n\u5047\u8bbe\u4f60\u7684 Windows IP \u662f 192.168.1.100&#xff0c;WSL IP \u662f 172.21.123.45&#xff0c;\u4f60\u5e0c\u671b\u5c40\u57df\u7f51\u5176\u4ed6\u7535\u8111\u901a\u8fc7\u8bbf\u95ee 192.168.1.100 \u7684 2222 \u7aef\u53e3\u6765\u8fde\u63a5 WSL \u7684 22 \u7aef\u53e3\u3002<\/p>\n<p>netsh interface portproxy add v4tov4 listenport&#061;2222 listenaddress&#061;0<span class=\"token punctuation\">.<\/span>0<span class=\"token punctuation\">.<\/span>0<span class=\"token punctuation\">.<\/span>0 connectport&#061;22 connectaddress&#061;172<span class=\"token punctuation\">.<\/span>21<span class=\"token punctuation\">.<\/span>123<span class=\"token punctuation\">.<\/span>45<\/p>\n<p>\u6267\u884c\u540e&#xff0c;\u5982\u679c\u6ca1\u6709\u4efb\u4f55\u9519\u8bef\u4fe1\u606f&#xff0c;\u5c31\u8868\u793a\u89c4\u5219\u6dfb\u52a0\u6210\u529f\u3002<\/p>\n<\/li>\n<li>\n<p>\u67e5\u770b\u5df2\u6709\u7684\u8f6c\u53d1\u89c4\u5219 (\u53ef\u9009)<\/p>\n<p>netsh interface portproxy show all<\/p>\n<\/li>\n<p>\u91cd\u8981\u63d0\u793a&#xff1a;WSL2 \u7684 IP \u5730\u5740\u5728\u91cd\u542f\u540e\u53ef\u80fd\u4f1a\u6539\u53d8\u3002\u5982\u679c\u91cd\u542f\u540e\u53d1\u73b0\u65e0\u6cd5\u8fde\u63a5&#xff0c;\u4f60\u9700\u8981\u91cd\u65b0\u83b7\u53d6 WSL \u7684 IP&#xff0c;\u5e76\u66f4\u65b0\u8fd9\u6761\u7aef\u53e3\u8f6c\u53d1\u89c4\u5219\u3002\u53ef\u4ee5\u5148\u5220\u9664\u65e7\u89c4\u5219\u518d\u6dfb\u52a0\u65b0\u89c4\u5219&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u5220\u9664\u65e7\u89c4\u5219<\/span><br \/>\nnetsh interface portproxy delete v4tov4 listenport&#061;2222 listenaddress&#061;0<span class=\"token punctuation\">.<\/span>0<span class=\"token punctuation\">.<\/span>0<span class=\"token punctuation\">.<\/span>0<br \/>\n<span class=\"token comment\"># \u6dfb\u52a0\u65b0\u89c4\u5219 (\u7528\u65b0\u7684 WSL IP)<\/span><br \/>\nnetsh interface portproxy add v4tov4 listenport&#061;2222 listenaddress&#061;0<span class=\"token punctuation\">.<\/span>0<span class=\"token punctuation\">.<\/span>0<span class=\"token punctuation\">.<\/span>0 connectport&#061;22 connectaddress&#061;&lt;\u65b0\u7684WSL<span class=\"token operator\">&#8211;<\/span>IP&gt;<\/p>\n<p>&#xff08;\u6709\u81ea\u52a8\u5316\u811a\u672c\u53ef\u4ee5\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898&#xff0c;\u4f46\u6211\u4eec\u5148\u624b\u52a8\u5b8c\u6210\u6d41\u7a0b\u3002&#xff09;<\/p>\n<hr \/>\n<h4>\u7b2c3\u6b65&#xff1a;\u5728 Windows \u9632\u706b\u5899\u4e2d\u521b\u5efa\u5165\u7ad9\u89c4\u5219<\/h4>\n<p>\u73b0\u5728&#xff0c;\u7aef\u53e3\u8f6c\u53d1\u8bbe\u7f6e\u597d\u4e86&#xff0c;\u4f46 Windows \u9632\u706b\u5899\u9ed8\u8ba4\u4f1a\u963b\u6b62\u5916\u90e8\u8bbe\u5907\u8bbf\u95ee 2222 \u7aef\u53e3\u3002\u6211\u4eec\u9700\u8981\u4e3a\u5b83\u5f00\u4e00\u4e2a\u201c\u53e3\u5b50\u201d\u3002<\/p>\n<li>\n<p>\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u6253\u5f00 PowerShell (\u5982\u679c\u5df2\u6253\u5f00\u5219\u4e0d\u7528\u91cd\u590d)<\/p>\n<\/li>\n<li>\n<p>\u6267\u884c\u9632\u706b\u5899\u89c4\u5219\u547d\u4ee4<br \/>\n\u6211\u4eec\u5c06\u4f7f\u7528 New-NetFirewallRule \u547d\u4ee4\u3002<\/p>\n<ul>\n<li>DisplayName: \u89c4\u5219\u7684\u540d\u5b57&#xff0c;\u65b9\u4fbf\u4f60\u8bc6\u522b\u3002<\/li>\n<li>Direction: Inbound (\u5165\u7ad9)\u3002<\/li>\n<li>Action: Allow (\u5141\u8bb8)\u3002<\/li>\n<li>Protocol: TCP\u3002<\/li>\n<li>LocalPort: \u4f60\u5728\u7aef\u53e3\u8f6c\u53d1\u4e2d\u8bbe\u7f6e\u7684 Windows \u76d1\u542c\u7aef\u53e3&#xff08;\u4f8b\u5982 2222&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u793a\u4f8b\u547d\u4ee4&#xff1a;<\/p>\n<p><span class=\"token function\">New-NetFirewallRule<\/span> <span class=\"token operator\">&#8211;<\/span>DisplayName <span class=\"token string\">&#034;WSL2 SSH Access&#034;<\/span> <span class=\"token operator\">&#8211;<\/span>Direction Inbound <span class=\"token operator\">&#8211;<\/span>Action Allow <span class=\"token operator\">&#8211;<\/span>Protocol TCP <span class=\"token operator\">&#8211;<\/span>LocalPort 2222<\/p>\n<p>\u6267\u884c\u6210\u529f\u540e&#xff0c;\u9632\u706b\u5899\u89c4\u5219\u5c31\u6dfb\u52a0\u597d\u4e86\u3002<\/p>\n<\/li>\n<hr \/>\n<h4>\u5927\u529f\u544a\u6210&#xff01;\u73b0\u5728\u8fdb\u884c\u6d4b\u8bd5<\/h4>\n<p>\u73b0\u5728&#xff0c;\u4ece\u5c40\u57df\u7f51\u5185\u7684\u53e6\u4e00\u53f0\u7535\u8111\u4e0a&#xff0c;\u6253\u5f00\u7ec8\u7aef\u6216 SSH\u5ba2\u6237\u7aef&#xff0c;\u6267\u884c\u8fde\u63a5\u547d\u4ee4&#xff1a;<\/p>\n<ul>\n<li>SSH \u7528\u6237\u540d: \u4f60\u5728 WSL (Ubuntu) \u4e2d\u7684\u7528\u6237\u540d\u3002<\/li>\n<li>IP \u5730\u5740: \u4f60\u7684 Windows \u4e3b\u673a\u5728\u5c40\u57df\u7f51\u7684 IP \u5730\u5740 (\u4f8b\u5982 192.168.1.100)\u3002<\/li>\n<li>\u7aef\u53e3: \u4f60\u5728 Windows \u4e0a\u8bbe\u7f6e\u7684\u76d1\u542c\u7aef\u53e3 (\u4f8b\u5982 2222)\u3002<\/li>\n<\/ul>\n<p>\u8fde\u63a5\u547d\u4ee4\u793a\u4f8b&#xff1a;<\/p>\n<p><span class=\"token function\">ssh<\/span> your_wsl_username&#064;192.168.1.100 -p <span class=\"token number\">2222<\/span><\/p>\n<p>\u9996\u6b21\u8fde\u63a5\u65f6&#xff0c;\u4f1a\u63d0\u793a\u4f60\u786e\u8ba4\u670d\u52a1\u5668\u7684\u6307\u7eb9&#xff0c;\u8f93\u5165 yes\u3002\u7136\u540e\u8f93\u5165\u4f60\u5728 WSL \u4e2d\u7684\u7528\u6237\u5bc6\u7801&#xff0c;\u5373\u53ef\u6210\u529f\u767b\u5f55&#xff01;<\/p>\n<h4>\u603b\u7ed3\u6d41\u7a0b<\/h4>\n<li>WSL \u7aef&#xff1a;\u88c5\u597d openssh-server&#xff0c;\u6539\u597d\u914d\u7f6e&#xff0c;\u542f\u52a8\u670d\u52a1&#xff0c;\u8bb0\u4e0b IP\u3002<\/li>\n<li>Windows \u7aef (\u7ba1\u7406\u5458 PowerShell)&#xff1a;\u7528 netsh \u547d\u4ee4\u521b\u5efa\u7aef\u53e3\u8f6c\u53d1&#xff0c;\u5c06 WindowsIP:\u5916\u90e8\u7aef\u53e3 \u8f6c\u53d1\u5230 WSL-IP:SSH\u7aef\u53e3\u3002<\/li>\n<li>Windows \u7aef (\u7ba1\u7406\u5458 PowerShell)&#xff1a;\u7528 New-NetFirewallRule \u547d\u4ee4\u5728\u9632\u706b\u5899\u4e0a\u4e3a \u5916\u90e8\u7aef\u53e3 \u521b\u5efa\u4e00\u4e2a TCP \u5165\u7ad9\u5141\u8bb8\u89c4\u5219\u3002<\/li>\n<li>\u5176\u4ed6\u7535\u8111&#xff1a;\u4f7f\u7528 ssh &lt;wsl\u7528\u6237\u540d&gt;&#064;&lt;windows\u4e3b\u673aIP&gt; -p &lt;\u5916\u90e8\u7aef\u53e3&gt; \u8fdb\u884c\u8fde\u63a5\u3002<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb621\u6b21\uff0c\u70b9\u8d5e24\u6b21\uff0c\u6536\u85cf23\u6b21\u3002WSL \u7aef\uff1a\u88c5\u597d\uff0c\u6539\u597d\u914d\u7f6e\uff0c\u542f\u52a8\u670d\u52a1\uff0c\u8bb0\u4e0b IP\u3002Windows \u7aef (\u7ba1\u7406\u5458 PowerShell)\uff1a\u7528netsh\u547d\u4ee4\u521b\u5efa\u7aef\u53e3\u8f6c\u53d1\uff0c\u5c06WindowsIP:\u5916\u90e8\u7aef\u53e3\u8f6c\u53d1\u5230WSL-IP:SSH\u7aef\u53e3\u3002Windows \u7aef (\u7ba1\u7406\u5458 PowerShell)\uff1a\u7528\u547d\u4ee4\u5728\u9632\u706b\u5899\u4e0a\u4e3a\u5916\u90e8\u7aef\u53e3\u521b\u5efa\u4e00\u4e2a TCP \u5165\u7ad9\u5141\u8bb8\u89c4\u5219\u3002\u5176\u4ed6\u7535\u8111\uff1a\u4f7f\u7528ssh @ -p \u8fdb\u884c\u8fde\u63a5\u3002_wsl \u5b89\u88c5ssh<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,77,103,149,2385],"topic":[],"class_list":["post-47288","post","type-post","status-publish","format-standard","hentry","category-server","tag-linux","tag-ssh","tag-ubuntu","tag-windows","tag-2385"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4e09\u6b65\u641e\u5b9a\uff01\u8ba9\u4f60\u7684 WSL2 \u53d8\u8eab\u5c40\u57df\u7f51\u5185\u7684 SSH \u670d\u52a1\u5668 - \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\/47288.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4e09\u6b65\u641e\u5b9a\uff01\u8ba9\u4f60\u7684 WSL2 \u53d8\u8eab\u5c40\u57df\u7f51\u5185\u7684 SSH \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb621\u6b21\uff0c\u70b9\u8d5e24\u6b21\uff0c\u6536\u85cf23\u6b21\u3002WSL \u7aef\uff1a\u88c5\u597d\uff0c\u6539\u597d\u914d\u7f6e\uff0c\u542f\u52a8\u670d\u52a1\uff0c\u8bb0\u4e0b IP\u3002Windows \u7aef (\u7ba1\u7406\u5458 PowerShell)\uff1a\u7528netsh\u547d\u4ee4\u521b\u5efa\u7aef\u53e3\u8f6c\u53d1\uff0c\u5c06WindowsIP:\u5916\u90e8\u7aef\u53e3\u8f6c\u53d1\u5230WSL-IP:SSH\u7aef\u53e3\u3002Windows \u7aef (\u7ba1\u7406\u5458 PowerShell)\uff1a\u7528\u547d\u4ee4\u5728\u9632\u706b\u5899\u4e0a\u4e3a\u5916\u90e8\u7aef\u53e3\u521b\u5efa\u4e00\u4e2a TCP \u5165\u7ad9\u5141\u8bb8\u89c4\u5219\u3002\u5176\u4ed6\u7535\u8111\uff1a\u4f7f\u7528ssh @ -p \u8fdb\u884c\u8fde\u63a5\u3002_wsl \u5b89\u88c5ssh\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/47288.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-29T23:13:00+00:00\" \/>\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\/47288.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/47288.html\",\"name\":\"\u4e09\u6b65\u641e\u5b9a\uff01\u8ba9\u4f60\u7684 WSL2 \u53d8\u8eab\u5c40\u57df\u7f51\u5185\u7684 SSH \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-29T23:13:00+00:00\",\"dateModified\":\"2025-07-29T23:13:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/47288.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/47288.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/47288.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4e09\u6b65\u641e\u5b9a\uff01\u8ba9\u4f60\u7684 WSL2 \u53d8\u8eab\u5c40\u57df\u7f51\u5185\u7684 SSH \u670d\u52a1\u5668\"}]},{\"@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":"\u4e09\u6b65\u641e\u5b9a\uff01\u8ba9\u4f60\u7684 WSL2 \u53d8\u8eab\u5c40\u57df\u7f51\u5185\u7684 SSH \u670d\u52a1\u5668 - \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\/47288.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4e09\u6b65\u641e\u5b9a\uff01\u8ba9\u4f60\u7684 WSL2 \u53d8\u8eab\u5c40\u57df\u7f51\u5185\u7684 SSH \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb621\u6b21\uff0c\u70b9\u8d5e24\u6b21\uff0c\u6536\u85cf23\u6b21\u3002WSL \u7aef\uff1a\u88c5\u597d\uff0c\u6539\u597d\u914d\u7f6e\uff0c\u542f\u52a8\u670d\u52a1\uff0c\u8bb0\u4e0b IP\u3002Windows \u7aef (\u7ba1\u7406\u5458 PowerShell)\uff1a\u7528netsh\u547d\u4ee4\u521b\u5efa\u7aef\u53e3\u8f6c\u53d1\uff0c\u5c06WindowsIP:\u5916\u90e8\u7aef\u53e3\u8f6c\u53d1\u5230WSL-IP:SSH\u7aef\u53e3\u3002Windows \u7aef (\u7ba1\u7406\u5458 PowerShell)\uff1a\u7528\u547d\u4ee4\u5728\u9632\u706b\u5899\u4e0a\u4e3a\u5916\u90e8\u7aef\u53e3\u521b\u5efa\u4e00\u4e2a TCP \u5165\u7ad9\u5141\u8bb8\u89c4\u5219\u3002\u5176\u4ed6\u7535\u8111\uff1a\u4f7f\u7528ssh @ -p \u8fdb\u884c\u8fde\u63a5\u3002_wsl \u5b89\u88c5ssh","og_url":"https:\/\/www.wsisp.com\/helps\/47288.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-29T23:13:00+00:00","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\/47288.html","url":"https:\/\/www.wsisp.com\/helps\/47288.html","name":"\u4e09\u6b65\u641e\u5b9a\uff01\u8ba9\u4f60\u7684 WSL2 \u53d8\u8eab\u5c40\u57df\u7f51\u5185\u7684 SSH \u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-29T23:13:00+00:00","dateModified":"2025-07-29T23:13:00+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/47288.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/47288.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/47288.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4e09\u6b65\u641e\u5b9a\uff01\u8ba9\u4f60\u7684 WSL2 \u53d8\u8eab\u5c40\u57df\u7f51\u5185\u7684 SSH \u670d\u52a1\u5668"}]},{"@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\/47288","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=47288"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/47288\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=47288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=47288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=47288"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=47288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}