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

Ray*_*ito 3 linux cross-compiling visual-studio

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

我按照说明操作:

  • 主机名= localhost
  • 港口= 22
  • 用户名=我为WSL创建的用户名
  • 验证类型=密码
  • 密码=我为WSL用户名创建的密码.

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

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

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

Ray*_*ito 5

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

做: sudo nano /etc/ssh/sshd_config

更改:

# What ports, IPs and protocols we listen for
Port 22
Run Code Online (Sandbox Code Playgroud)

# What ports, IPs and protocols we listen for
Port 2222
Run Code Online (Sandbox Code Playgroud)

假设您在Microsoft的WSL设置教程中遵循了其他所有内容.这会奏效.

根据该链接中的@fnt,端口22不起作用,因为Microsoft在该端口上运行了SSH服务器代理.