To setup a ssh server on your linux VM in WSL2 on windows


  • In the WSL2 system setup ssh to your liking and turn it on
service ssh start
systemctl enable ssh
  • In Power Shell, enable the port forwarding (subbing in your VMs IP (ifconfig)):

netsh interface portproxy add v4tov4 listenport=2222 listenaddress= connectport=2222 connectaddress=

  • In Windows Defender Firewall, allow port 22