Post

WSL2 - Changing the default username

This guide is using Ubuntu as the distribution

If you have already setup your Ubuntu user and would like to change the default, this is how to do it:

First, open Ubuntu and create the user that matches your default:

1
sudo adduser example-user

Then add the newly created user into the sudo group:

1
sudo usermod -a -G sudo example-user

Go back to CMD or PowerShell and find the instance name

1
2
3
4
wsl -l

Windows System for Linux Distributions:
Ubuntu (Default)

Then use the instance name and change the default user

1
Ubuntu config --default-user example-user

This will prompt a restart of Ubuntu that you still have open.

All done!

This post is licensed under CC BY 4.0 by the author.