Problem: whenever you reboot Windows machine, the sshd server on WSL stops. If this happens, you need to manually start the service as a root.
Below procedure allows to run it semi-automatically. Every time you open a terminal window, the script will check if the sshd process is running. If not, it will start it using sudo without asking for password.
Install SSH server
sudo apt install openssh-server
Add the following line to the user’s .bashrc file
vim /home/jakub/.bashrc ps -C sshd >/dev/null && echo "sshd is running" || sudo service ssh start
Disable sudo password (add this entry to the /etc/sudoers file)
jakub ALL=(ALL) NOPASSWD:ALL