Ubuntu – Reset User Password on Ubuntu Terminal in Windows 10 Environment

passwordpassword-recoverywindows 10

I am using Ubuntu on Windows, downloaded from the Microsoft Store. I created a user password, but it appears I either forgot it or typed it in wrong. For sudo commands, my user password is not working.

Since I cannot reboot the system as Linux using Grub to reset the password, is there another way to reset my user password without re-installing the app (I have several applications already set up)?

Best Answer

Open the command prompt, type either ubuntu config --default-user root or lxrun /setdefaultuser root. Hit Enter.

Next, open the Linux Bash shell and it will log you as root without asking a password. So you can then use the following command to reset your forgotten user password:

passwd user_name

When done, open the command prompt and run this command:

ubuntu config --default-user user_name

This will set your Linux Bash shell to run with your regular user.

Source: https://www.top-password.com/blog/forgot-linux-bash-password-in-windows-10/

Related Question