-1

How do I either recover or reset my admin password in a situation where I installed Ubuntu using the Windows Subsystem for Linux? I am running Ubuntu 20.04.1.0.

3
  • No, because that thread is for Ubuntu 18.04. What's more, the suggestions posted there are inconsistent. Jul 2, 2021 at 13:34
  • The answer has not changed since 18.04. There are multiple answers.
    – Nmath
    Jul 2, 2021 at 16:32
  • This answer is really the only one that makes sense today. The others are either wrong, out-dated, or even dangerous (as they recommend editing the filesystem in a way that Microsoft says can cause corruption). I'd honestly rather provide a new, correct, up-to-date answer here on this question. Jul 2, 2021 at 17:40

1 Answer 1

0

Usually there just isn't a root password in WSL, since (a) your normal user has sudo rights and (b) running wsl -u root gets you full root access without a password. There's really not much of a concept of "login", except for a few special situations like SSH.

Is there something you are doing that requires a root password? You should be able to set it with wsl -u root passwd (from PowerShell or cmd), although I'm not at my PC to try it out at the moment.

If you need to reset the password of your primary user, perhaps for sudo access, then wsl -u root passwd username.

Not the answer you're looking for? Browse other questions tagged .