从 Windows 10 SSH 到 wsl2 ubuntu

标签 ssh windows-10 wsl-2

我对这项业务还很陌生,我不明白如何从我的 win10 机器通过 SSH 连接到我安装的 wsl2 ubuntu 20.4
基本上,我关注了this tutorial , 但我不断收到以下错误:

  • 当我尝试使用公共(public)端口(使用 curl ifconfig.me )进行 SSH 时,出现错误“连接超时”
  • 当我尝试使用私有(private)端口(使用 ip route get 1.2.3.4 | awk '{print $7}')SSH 时,它给了我错误“权限被拒绝”

  • 在某些时候,我收到了错误“sshd:没有可用的主机 key ——正在退出”,所以我关注了 this fix但后来我得到了之前提到的错误。我应该从 /etc/ssh 中删除任何内容吗?文件夹?
    最终目标是通过 vs-code ssh'ing,但我想一旦我可以从 powershell 中做到这一点,vs-code 也是如此。

    最佳答案

    看来你需要输入/etc/ssh/sshd_config (具有 sudo 权限)并更改以下几行:

  • ChallengeResponseAuthentication yes
  • PasswordAuthentication yes
  • 关于从 Windows 10 SSH 到 wsl2 ubuntu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65196276/

    相关文章:

    git - 从CloudBuild访问GitHub存储库

    unit-testing - 在 Go 中对 SSH 客户端进行单元测试

    linux - 使用 ssh 启用无密码身份验证

    python - 权限错误 : [WinError 5] Access is denied: 'C:\\Program Files\\Anaconda3\\pkgs\\vs2015_runtime-14. 0.25123-0.tmp

    bash - 如何在制作 bash 脚本时区分 Linux 和 Windows 10 bash

    c# - 无法激活 Windows 应用商店应用程序(Visual Studio 2015,Windows 10 版本 1511)

    windows - 在 HTTP 代理下工作时 Windows 上的 SSH 配置

    Docker 无法在 Windows 上运行 Ubuntu 20.04

    ruby - 无法在 headless 模式下启动 Chrome

    reactjs - 断点无法通过 Windows 10 和 WSL2 上的 Visual Studio Code 在 Chrome 中调试 React 应用程序