I recently wanted to install something within my Ubuntu shell and could not remember the password, and thought I was stuck. However, I found a way of resetting it quickly and easily.
- Open Bash on Ubuntu to take note of your Linux username (note that this may or may not match your Windows username)
- Close your bash session; you must do this for the following commands to work.
- Open a Windows command prompt as Admin
ubuntu config --default-user rootto set the default user as root.
5. Now open your Ubuntu shell again. This time you'll notice you are logged in as root.
6. You now want to change the password of your account type,
passwd [username] and follow the instructions to reset your password. Close the Ubuntu shell.
7. Now, you want to change your Ubuntu shell to make your profile the default user. Within a Windows command prompt, run the following command
ubuntu config --default-user [username]
When you open your Ubuntu shell, your profile will defaultto yours, and the password will be reset.