I recently wanted to install something within my Ubuntu shell and could not remember what the password was 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 need to 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.
- Now open your Ubuntu shell again. This time you'll notice you are logged in as root.
- 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.
- Now you want to change your Ubuntu shell back to have your profile as the default user. Within a Windows command prompt run the following command
ubuntu config --default-user [username]
Now when you open your Ubuntu shell your profile will default open to yours and the password will be reset.