Installation#
Actually, it's very simple to open directly, just install openssh-client
and openssh-server
apt install openssh-client openssh-server
Enable#
After installation, change the port to avoid being attacked every day
Since systemctl
is basically disabled in WSL, you can't start it directly with systemctl
So use the more primitive service
service ssh start
Auto-Start#
Here you need to use a more abstract method to start WSL's sshd along with Windows
Enter shell:startup
in the Windows run
Then open a directory, create a .vbs
file with any name inside, and then...
Then go in and edit and enter this string
Set ws = WScript.CreateObject("WScript.Shell")
ws.run "wsl -d <your system name> -u root /usr/sbin/service ssh --full-restart", vbhide
I'm using Debian as an example here
Then save, that's it
Completion#
You can now try to connect, you can test it with Windows cmd
Okay, everything is normal
This tutorial ends here. If it helps you, feel free to share it with others
And please give it a like, if you have the ability, please consider supporting. Your like is my motivation for updates, thank you meow
This article is synchronized updated to xLog by Mix Space
The original link is https://blog.nekorua.com/posts/technology/122.html