Skip to content

Instantly share code, notes, and snippets.

@thinsoldier
Created January 15, 2022 00:54
Show Gist options
  • Save thinsoldier/5615c7a208dea94c271f2dca0a277162 to your computer and use it in GitHub Desktop.
Save thinsoldier/5615c7a208dea94c271f2dca0a277162 to your computer and use it in GitHub Desktop.
reset-the-password-in-ubuntu-linux-bash-in-windows
https://askubuntu.com/questions/772050/reset-the-password-in-ubuntu-linux-bash-in-windows
Close Bash on Ubuntu if it is running (or the next command will fail).
In Windows admin command prompt (Super+X, A) change the default user to root:
ubuntu config --default-user root
If you are using Ubuntu 18.04 in WSL, the command has changed to ubuntu1804 , so
ubuntu1804 config --default-user root
Now Bash on Ubuntu on Windows logs you in as root without asking password
Use passwd command in Bash to change the user password (the user whose password you want to reset):
passwd your_username
Change the default user back to your normal user in Windows command prompt
ubuntu config --default-user your_username
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment