Score:0

Trying to use sudo in WSL but my Microsoft account (which I'm logged into as Admin on Windows 10) password won't work. How can I fix it?

kr flag

When I look into what my admin password is on Windows 10, everything seems to point to it being linked to the Microsoft account I have connected.

I validated this, it seems to be the case that I am not currently using a local account:

enter image description here

But the same password I'm able to use to log into this Microsoft account with does not work when I attempt to run sudo in WSL. There is only one account on my PC.

What detail have I missed or how can I troubleshoot?

Score:4
jp flag

Your Windows Subsystem for Linux (WSL) password is not your Windows password. To change your WSL password, try the following steps.

On a Windows prompt, enter the command:

wsl --user root

You should be logged in as root into your WSL. Now, use the passwd command to change the password for your user:

passwd username

Replace username with your actual Linux username.

You will be asked to type a new password without being asked for the current one. Once you're done, just leave the session with exit. Your user's password should have been changed.

Source: How To Reset Your Forgotten Linux Password in WSL (CloudSavvyIT)

NotTheDr01ds avatar
vn flag
Can be simplified to just `wsl -u root passwd <username>`
AdSR avatar
co flag
I'm getting "user not found".
Score:0
ng flag

If you do not know your password, type passwd at the prompt and you can change your password.

Your Ubuntu password is not the same as your Windows password.

J.Todd avatar
kr flag
When I type `passwd`, it asks for my current password.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.