Tools: How to Reset Your Forgotten WSL Password (Quick Fix) (2026)

Tools: How to Reset Your Forgotten WSL Password (Quick Fix) (2026)

The Problem

What You Need

Method 1: Reset via Root Login (Recommended)

Step 1 — Find your distro name

Step 2 — Log in as root

Step 3 — Reset your password

Step 4 — Exit and verify

Method 2: Change Default User to Root (If Method 1 Doesn't Work)

How to Never Get Stuck Again I've had to do this three times now, so I finally wrote it down. If you use WSL inside VS Code and keep forgetting your Linux password (it happens!), this is your go-to reference. WSL (Windows Subsystem for Linux) has its own separate password from your Windows login. If you rarely run sudo commands, it's easy to forget, and when you need it (like installing a Python package), you're stuck. Here's how to reset it in under two minutes. Open a Windows Command Prompt or PowerShell, not your WSL terminal. Note the name shown (e.g. Ubuntu or Ubuntu-22.04). Replace Ubuntu with your actual distro name. Type your new password twice when prompted. You won't see characters as you type — that's normal. Reopen your WSL terminal normally. You can now sudo with your new password. Run these in Windows PowerShell: 1. Set root as the default WSL user temporarily: 2. Open WSL, then reset your password: 3. Restore your normal user as default (back in PowerShell): Tested on WSL 1 and WSL 2, Windows 10 and Windows 11. Templates let you quickly answer FAQs or store snippets for re-use. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse

Code Block

Copy

wsl -d Ubuntu -u root wsl -d Ubuntu -u root wsl -d Ubuntu -u root passwd your-username passwd your-username passwd your-username ubuntu config --default-user root ubuntu config --default-user root ubuntu config --default-user root passwd your-username passwd your-username passwd your-username ubuntu config --default-user your-username ubuntu config --default-user your-username ubuntu config --default-user your-username - A Windows PC with WSL installed - Access to Windows Command Prompt or PowerShell (not the WSL terminal) - Your WSL distro name (e.g. Ubuntu, Ubuntu-22.04) - Use a password manager —WSL credentials are separate from Windows, so store them in Bitwarden, 1Password, etc. - Bookmark this article — seriously, just do it 😅