If you are using Windows Subsystem for Linux and you forgot your password, here is a small howto to reset it.
This howto is based on Ubuntu 18.04 but it seems it can be used for any other version.
- Launch Ubuntu 18.04 and run the following command to get your username : whoami
- Launch a command or PowerShell console and run the following command. It will set the default user to root
ubuntu1804 config --default-user root
- Launch Ubuntu 18.04 again and you should be logged with the root account
- Reset you password by running the following command : passwd your_username
root@computer:~# passwd your_username
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
- In the command or PowerShell console run the following command to set the default account to your username instead of the root account
ubuntu1804 config --default-user your_username
- Enjoy using WSL