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.
I follow the instructions:
- Host Name = localhost
- Port = 22
- User name = User name I created for WSL
- Authentication Type = Password
- Password = Password I created for WSL user name.
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.
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.
Any ideas as to why I can't connect to my WSL?
Using the information in this link, I was able to solve the issue. Just had to change the port from 22 into another port.
Do:
sudo nano /etc/ssh/sshd_config
Change:
to
Assuming you followed everything else in the WSL set-up tutorial from Microsoft. This will work.
According to @fnt in that link, port 22 doesn't work because Microsoft has SSH Server Broker running on that port.