38

I forgot my WSL Ubuntu password, needed to run sudo command. After running the folowing command

lead@kernel:~$ sudo su

I got this

Sorry, try again

Any alternatives? Thanks

3 Answers3

88

I had the same problem. The first comment by @Ramhound solved it for me.

In the terminal outside of WSL:

  1. Run wsl -u root

Note: If you have more than one distribution then run wsl -d <your-distro-name> -u root instead of wsl -u root. with this command, you can choose a specific one. Replace <your-distro-name> with your distro name (For example: Ubuntu-22.04)

  1. Run passwd <username>

  2. Enter new password

Simulan88
  • 991
6

run 'wsl -u root' (if have only one distro installed) run 'wsl -u root ' (if you have more than one distro installed) once in root you can run 'passwd' if that doesn't work run 'usermod passwd ' that should do it. worked for me.

-1

reset root password of WSL and then change your user password on windows command prompt : ubuntu config --default-user root ref:https://itsfoss.com/reset-linux-password-wsl/