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
I had the same problem. The first comment by @Ramhound solved it for me.
In the terminal outside of WSL:
wsl -u root
Note: If you have more than one distribution then run
wsl -d <your-distro-name> -u root
instead ofwsl -u root
. with this command, you can choose a specific one. Replace<your-distro-name>
with your distro name (For example:Ubuntu-22.04
)
Run passwd <username>
Enter new password
ubuntu
forkali
since I'm using Ubuntu with WSL. Thanks @MarkusMeyer.