Visual Studio 2017 无法连接到 WSL 说用户名和密码错误

Visual Studio 2017 cannot connect to WSL says Username and Password are wrong

我遵循了本教程 from Microsoft。我创建了我的 WSL 用户名和密码,安装了所有必要的应用程序,并启动了 SSH 服务。问题出在我从 Tools > Options > Cross Platform > Connection Manager 菜单中的 Visual Studio 连接到它时。

我按照说明操作:

当我这样做时,它说我的用户名或密码不正确。但我知道他们是对的。我无法 post 图片来显示它,因为我的声誉还没有达到 10,但它以红色突出显示用户名和密码栏并显示 Authentication failure. Please make sure credentials are correct.

我知道我可以连接到设备,因为我尝试连接到我的 Raspberry Pi。每当我尝试调试任何东西时,它都会给我一个分段错误。但这是另一天的问题。

关于为什么我无法连接到我的 WSL 的任何想法?

Using the information in this link, I was able to solve the issue. 只需将端口从 22 更改为另一个端口。

做: sudo nano /etc/ssh/sshd_config

变化:

# What ports, IPs and protocols we listen for
Port 22

# What ports, IPs and protocols we listen for
Port 2222

假设您遵循了 Microsoft WSL 设置教程中的所有其他内容。这会起作用。

根据@fnt 在 link 中的说法,端口 22 不起作用,因为 Microsoft 在该端口上有 SSH Server Broker 运行。