Content Insights Tip #48 | How can I reset my password of my WSL account?

 

Content Insights Logo

Do you ever find yourself forgetting your password from time to time? I certainly do! While most of my passwords are securely stored in a Password Vault like Dashlane or LastPass, managing a WSL (Windows Subsystem for Linux) account password can be a bit trickier. This is particularly true when dealing with sudo commands in WSL, where the password may slip your mind.


No worries, though! Resetting your WSL account password is a breeze with these simple steps:

  1. Identify your WSL username, which you can find in the WSL Command prompt. It's the part before the @ symbol. In my case, it's "ronaldp."
  2. Open a Command prompt as Administrator.
  3. Switch the default user to root by executing the command: ubuntu config --default-user root. This will close any existing WSL Command prompt.
  4. Open a new WSL Command prompt.
  5. To reset the password for your account, use the command: passwd [your_username].
  6. Type your new password twice.
  7. Switch back to your Command prompt and execute the command: ubuntu config --default-user [your_username]. This sets the default user back to your original username (e.g., "ronaldp" in my case).
  8. Open a new WSL Command prompt.
Is text not your thing? You can also view this video.

Voila! You should now be able to run your sudo commands smoothly once again. These straightforward steps ensure you regain control over your WSL account and can continue your work without any password-related hiccups.