How to reset WSL password

Share on:

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
1your_username@computer:~$ whoami
  • Launch a command or PowerShell console and run the following command. It will 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 or PowerShell console run the following command to set the default account to your username instead of the root account
1ubuntu1804 config --default-user your_username
  • Enjoy using WSL