Visual Studio 2017无法连接到WSL表示用户名和密码错误 [英] Visual Studio 2017 cannot connect to WSL says Username and Password are wrong

查看:176
本文介绍了Visual Studio 2017无法连接到WSL表示用户名和密码错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了本教程来自Microsoft 。我创建了WSL用户名和密码,安装了所有必需的应用程序,并启动了SSH服务。问题出在我从Visual Studio的工具>中连接到它时。选项>跨平台>连接管理器菜单。

I followed this tutorial from Microsoft. I created my WSL username and password, installed all the necessary applications, and started the SSH service. The problem lies when I go to connect to it from Visual Studio in the Tools > Options > Cross Platform > Connection Manager menu.

我按照说明进行操作:


  • 主机名=本地主机

  • 端口= 22

  • 用户名=我为WSL创建的用户名

  • 身份验证类型=密码

  • 密码=我为WSL用户名创建的密码。

  • Host Name = localhost
  • Port = 22
  • User name = User name I created for WSL
  • Authentication Type = Password
  • Password = Password I created for WSL user name.

当我这样做时,它说我的用户名或密码不正确。但是我知道他们是正确的。我无法发布图像来显示它,因为我的声誉还不到10,但是它用红色突出显示了用户名和密码栏,并显示身份验证失败。请确保凭据正确无误。

When I do this, it says my user name or password is incorrect. But I know they are correct. I can't post images to show it because my reputation is not at 10 yet but it highlights the username and password bar in red and says Authentication failure. Please make sure credentials are correct.

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

I know I can connect to devices because I tried connecting to my Raspberry Pi. Whenever I try and debug anything on that it gives me a segmentation fault. But that's another question for another day.

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

Any ideas as to why I can't connect to my WSL?

推荐答案

使用此链接中的信息,我能够解决这个问题。只需将端口从22更改为另一个端口。

Using the information in this link, I was able to solve the issue. Just had to change the port from 22 into another port.

执行:
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设置教程中的所有其他内容。这将起作用。

Assuming you followed everything else in the WSL set-up tutorial from Microsoft. This will work.

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

According to @fnt in that link, port 22 doesn't work because Microsoft has SSH Server Broker running on that port.

这篇关于Visual Studio 2017无法连接到WSL表示用户名和密码错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆