Set default user, switch user, remove a user for WSL
We will be covering the following procedures in this guide:
1] Set default user for WSL
When you open a WSL Distro on your Windows 10 computer, it starts signing you into a particular default user account. You can change this default user if you want. You need to open Command Prompt or Powershell with Administrator level rights.
Now execute the following commands for the several Linux distros:
Ubuntu:
Ubuntu 18.04 LTS:
Ubuntu 16.04 LTS:
openSUSE Leap 42:
SUSE Linux:
Debian:
Kali Linux:
You can also replace
2] Switch user in WSL
When you open a WSL distro, the command line automatically logs you into the default user we talked b. But if you want to switch user to another user account, it is fairly simple too.
Open the distro’s root location. Type in one of the following commands to switch to a particular user:
You will have to replace
3] Remove a user in WSL
In this case, there will be two scenarios. One will be where you are logged in as a SUDO user and the other one where you are logged in as ROOT. We will be covering both of these scenarios.
When logged in as a SUDO user.When logged in as a ROOT user.
When logged in as a SUDO user:
You need to execute the following command when you are logged in as a SUDO user and want to delete a User account inside the same Linux distro:
When logged in as a ROOT user:
And if you are logged in as ROOT, the method is slightly different. First, you need to refer to the above guide to set a default user. This default user will be the one that you want to remove. Then, you need to execute the following command to delete a user in the same Linux distro:
It is worth making sure that the