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 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 rootNote: If you have more than one distribution then run
wsl -d <your-distro-name> -u rootinstead 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
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.
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/