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, you can't start it directly with systemctl
3
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
6
Then open a directory, create a .vbs file with any name inside, and then...
7
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
8
Then save, that's it

Completion#

You can now try to connect, you can test it 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 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


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