Recently I had an issue with one of my WSL installations while setting up my new laptop. The password I believed to for the Linux user was incorrect. So rather than reinstalling the WSL2 distribution, I decided to look for alternatives.
I found a method to reset the password by changing the default startup user to use the root user of the distribution. The steps to reset the password in an Ubuntu Distribution are below.
ubuntu2004 config --default-user root
whoami
passwd <username>
ubuntu2004 config --default-user username
whoami
to check you are back under your user.note: using other WSL distributions, the commands will be different WSL exes are stored in
%userprofile%\AppData\Local\Microsoft\WindowsApps