Resetting WSL user password

Resetting WSL user password

Recently I had an issue with one of my WSL installations while setting up my new laptop. The password I believed to for the Linux user was incorrect. So rather than reinstalling the WSL2 distribution, I decided to look for alternatives.

I found a method to reset the password by changing the default startup user to use the root user of the distribution. The steps to reset the password in an Ubuntu Distribution are below.


  1. Open Command Prompt with Admin Privileges
  2. Run the command ubuntu2004 config --default-user root
  3. Open WSL2 into Ubuntu distribution
  4. Double check you are root whoami
  5. Run passwd <username>
  6. Close WSL2
  7. Back in the command prompt reset default user back ubuntu2004 config --default-user username
  8. Start WSL2 and run whoami to check you are back under your user.

note: using other WSL distributions, the commands will be different WSL exes are stored in %userprofile%\AppData\Local\Microsoft\WindowsApps

Further Reading