A minimal install of WSL2 does not run an SSH daemon; it is usually unnecessary, a direct terminal connection does not use SSH.
But we may want it anyways for testing and remote access
Install OpenSSH:
sudo apt update && sudo apt install openssh-server -y
Change settings:
sudo vi /etc/ssh/sshd_config
# Only listen to ipv6 connections
AddressFamily inet6
# Only allow SSH keys
#PubkeyAuthentication yes
PasswordAuthentication no
Restart to apply the changes:
systemctl restart sshd
Add the firewall rule for local IPv6 connections
sudo ufw allow from fe80::/64 to any port 22 proto tcp
Show your IPv6 connection, so you can test connecting to it from Windows:
ip -6 addr show dev eth0 | grep fe80