Open ssh connection in wsl 2

Original link: https://nicksxs.me/2023/04/23/%E5%9C%A8-wsl-2-%E4%B8%AD%E5%BC%80%E5%90%AF-ssh-% E8%BF%9E%E6%8E%A5/

WechatIMG605697.png

It is actually very convenient to enable ssh in wsl 1 before, as long as the sshd service is up, but it is not the same in wsl 2,
I am using Ubuntu 20.04 in wsl 2 here. Directly starting the sshd service cannot allow other machines to connect, and there is no ifconfig

This article is reproduced from: https://nicksxs.me/2023/04/23/%E5%9C%A8-wsl-2-%E4%B8%AD%E5%BC%80%E5%90%AF-ssh-% E8%BF%9E%E6%8E%A5/
This site is only for collection, and the copyright belongs to the original author.