Windows Subsystem for Linux has started to make Windows into an actual development platform! It’s not there yet, but it is getting there. Although I really appreciate how *nix and Macs have created the majority of dev workflows, I am excited to be able to use an upgradable $500 Windows 10 laptop instead of a $1,500 MacBook Pro with a really awful keyboard.
While we’re on the way to a great cross-platform solution, you might be only using WSL infrequently and have forgotten the password. Note that in Ubuntu world you always sudo for root access. As a best practice for all *nix machines you should never login as root.
What you’re going to do is change the default user to root, update the password using root privileges, then return your previous user to default.
It’s so easy, but it depends on which update you are using! See the bottom of the page for alternatives.
I’m on the Fall Creator’s Update with Ubuntu installed. The username example is “processio”
Open Windows CMD
Set the default Linux user to root:
C:\>ubuntu config --default-user root
Launch your Linux distribution (ubuntu). You will automatically login as root:
Reset your password using the passwd command (do the command then enter the password when prompted):
Close the WSL window.
Go back to CMD, reset your default user back to your normal Linux user account.
C:\> ubuntu config --default-user processio
Open WSL and you’re done! Make sure to try sudo apt-get update to confirm your password is working:
processio@machine-name:~#sudo apt-get update
Here’s the best reference from Microsoft: