Resetting WSL password

15/4/2023 One-minute read

Working on WSL after leaving it for a while, could be such a great lesson for you! I recently forgot my password and found out that there is a way to recover it easily.

Here is the solution:

  1. Change user to root.

    ubuntu config --default-user root
    

    For this, you might have a different run command for Ubuntu. which you can find in the reference but it’s like the next:

    • Kali for Kali
    • ubuntu 2004 for Ubuntu 20.04
    • and so on
  2. Set user password.

    here you need to open your WSL and set the password like Linux:

    passwd username
    
  3. Change back to the default user.

    ubuntu config --default-user USERNAME
    
  4. Horay!

Helpful resources: