banner
libxcnya.so

libxcnya.so

Nothing...
telegram
twitter
github
email

Enable SSH and set up automatic startup for WSL

Installation#

Actually, it's very simple to open directly, just install openssh-client and openssh-server
1

apt install openssh-client openssh-server

Enable#

After installation, change the port to avoid being attacked every day
2
Since systemctl is basically disabled in WSL, it cannot be started directly using systemctl
3
So, use the more primitive service

service ssh start

Auto-Start#

Here, a more abstract method is needed to start the wsl's sshd along with Windows
Enter shell:startup in the Windows run
6
Then open a directory, create a .vbs file with any name inside, and then...
7
This is the key point
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 use Debian as an example here
8
Then save, that's it

Completion#

Then you can try to connect, you can test with Windows cmd
9
Okay, everything is normal

This tutorial ends here. If it helps you, feel free to share it with others
And please give it a thumbs up, if you are able to, please support, your like is my motivation for updates, thank you meow

This article is synchronized and updated to xLog by Mix Space
The original link is https://blog.nekorua.com/posts/technology/122.html


Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.