I installed the WSL Bash on Windows 10 and set my user to e.g. 'abc' but now I want to change it to something else.
How can I change the user name of the user I'm logged in as?
When I open bash it automatically logs me in with my current user.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
All other answers were helpful, but can be other scenarios too, follow here as per yours. Mine was Ubuntu 16.04, so I used the following:
ubuntu1604 config --default-user <username>
If you installed Ubuntu 18.04:
ubuntu1804 config --default-user <username>
If you used the default one, then:
ubuntu config --default-user <username>
Inside the instance, as root, create/edit
/etc/wsl.conf and add these lines:
Then close it, run
wsl --terminate <distro name> in PowerShell, and restart it.
That's from an issue in the WSL repo. The registry hack answer is also in there, but
/etc/wsl.conf is now officially the supported solution.
See which distros you have installed
I have Ubuntu and I wanted to set the default user to root
ubuntu config --default-user root