Change WSL2 Password
If you have forgotten your WSL2 password, this is how you change it.
- Open the terminal.
-
Run
wsl -lto see all distros and find the one you want to reset the password for. For example, we want to reset the password for userusr001in the distroubuntu-20.04.wsl -l -
Set default user to root. You must remove all
-,.andwhitespacesfrom the distro name.ubuntu2004 config --default-user root -
Open WSL2 and select a new password.
passwd usr001 -
Open the terminal again and set
usr001as the default user.ubuntu2004 config --default-user usr001