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