Reset Ubuntu Password in WSL on Windows 10
Miscellaneous
21 Feb 2020If you’ve forgotten your password for WSL don’t worry, it can be easily reset by following the seven steps below.
- Open Bash on Ubuntu to take note of your Linux username (note that this may or may not match your Windows username)
- Close Bash on Ubuntu (if you leave it running the next command will fail)
- Open a Windows command prompt as Admin (Windows Key + X, A)
- Enter
ubuntu config --default-user root
to set the default user as root.- note: this has changed for Ubuntu 18.04 in WSL so you’ll need to run
ubuntu1804 config --default-user root
- note: this has changed for Ubuntu 18.04 in WSL so you’ll need to run
- Open Bash on Ubuntu. You should notice that you are login in as
root
without having to enter a password. - To change your password run
passwd [username]
and follow the prompts to set a new password - The last thing you need to do is change the default user back to your normal user in Windows command prompt by running
ubuntu config --default-user [username]
You can test if this worked by opening a new bash prompt and running sudo apt-get update
. When prompted enter your new password and you should be set.
WSL Tip: did you know you could start a new bash shell from inside of PowerShell, simply by running bash
?