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:
- 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."
- Open a Command prompt as Administrator.
- Switch the default user to root by executing the command: ubuntu config --default-user root. This will close any existing WSL Command prompt.
- Open a new WSL Command prompt.
- To reset the password for your account, use the command: passwd [your_username].
- Type your new password twice.
- 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).
- 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.