Answer the question
In order to leave comments, you need to log in
How to change default user in WSL2 after --import?
Good afternoon.
A few days ago I made a backup of the Ubuntu20.04 WSL distribution (wsl.exe --export ...). Then I restored this image ( wsl.exe --import ...).
There was one problem - by default, the distribution starts from the root user, there is another user user in the system. Now, in order to switch between users, I use su - user, but I can not force the distribution kit to start from this user.
I found solutions on the net using lxrun (lxrun / setdefaultuser user), but as I understand it, lxrun was available in the first version of WSL, and at the moment it is dredged from Windows (at least in c: \ windows \ system32 - I did not find it and in powershell when calling lxrun/lxrun .exe I get an error).
Tell me how to change the user on whose behalf the distribution kit will start now?
Answer the question
In order to leave comments, you need to log in
wsl [-d distroname] -u username
about the config, it seems like it is googled and executed without error messages like this
wsl --setdefault distroname config --default-user username
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question