After running the following command:
C:\> ubuntu config --default-user root
You need to reboot, at which point your default user will be root.
Another reboot is required after changing back to your default user.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
more simple way:kill wsl.exe and wslhost.exe, then open bash and you will be root.
In the latest builds you can use wsl --shutdown or wsl --terminate to ensure distros are terminated so you can rerun as the appropriate user.
WSL has gone through many updates and revisions, and this issue may be fixed in the latest version. We're cleaning out some of our older issues, and will mark this as closed. If you are still experiencing this issue on the latest version please feel free to reopen this! Thank you!
Most helpful comment
more simple way:kill
wsl.exeandwslhost.exe, then openbashand you will be root.