How to reset WSL password
If you are using Windows Subsystem for Linux and you forgot your password, here is how to to reset it.
It's based on Ubuntu 18.04 but you can use it for any other version.
- Launch Ubuntu 18.04 and run the following command to get your username : whoami
1your_username@computer:~$ whoami 2your_username
- Launch a command prompt or PowerShell console and run the following command to set the default user to root
1ubuntu1804 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
1root@computer:~# passwd your_username 2Enter new UNIX password: 3Retype new UNIX password: 4passwd: password updated successfully
- In the command prompt or PowerShell console run the following command to set back the default account to your username instead of the root account
1ubuntu1804 config --default-user your_username