You may have multiple user accounts in a WSL Linux distro. This post shows how to remove a user account from WSL Linux in Windows 10.
The ability to run Linux natively in Windows 10 is provided by the WSL feature. WSL stands for Windows Subsystem for Linux, which initially, was limited to Ubuntu only. Modern versions of WSL allow installing and running multiple Linux distros from Microsoft Store.
After enabling WSL, you can install various Linux versions from the Store. You can use the following links:
When you start a WSL distro for the first time, it opens a console window with a progress bar. After a moment of waiting, you will be prompted to type a new user account name, and its password. This account will be your default WSL user account that will be used to sign-in automatically every time you run the current distro. Also, it will be included in the 'sudo' group in order to allow it to run commands elevated (as root).
Each Linux distribution running on the Windows Subsystem for Linux has its own Linux user accounts and passwords. You will have to configure a Linux user account any time you add a distribution, reinstall, or reset. Linux user accounts are not only independent per distribution, they are also independent from your Windows user account.
To Remove User From WSL Linux Distro in Windows 10,
- Run your WSL Linux distro, e.g. Ubuntu.
- Execute the command
sudo deluser <username>.
- Substitute the
<username>portion with the actual user name you want to create.
- Type your current password when prompted.
- The user account will be removed.
You are done.
Note: If your user account is not part of sudoers, you need to switch the default user to root. Use the following commands to change your default user to
root in a WSL distro.
ubuntu config --default-user root
- openSUSE Leap 42:
openSUSE-42 config --default-user root
- SUSE Linux:
SLES-12 config --default-user root
debian config --default-user root
- Kali Linux:
kali config --default-user root
After that, execute the command
deluser <username>, i.e. just omit the sudo command.
By replacing 'root' with another user account name in the commands above, you can restore your default user account for the distro.
- Add User to WSL Linux Distro in Windows 10
- Update and Upgrade WSL Linux Distro in Windows 10
- Run WSL Linux Distro as Specific User in Windows 10
- Reset and Unregister WSL Linux Distro in Windows 10
- Reset Password for WSL Linux Distro in Windows 10
- All Ways to Run WSL Linux Distro in Windows 10
- Set Default WSL Linux Distro in Windows 10
- Find Running WSL Linux Distros in Windows 10
- Terminate Running WSL Linux Distro in Windows 10
- Remove Linux from Navigation Pane in Windows 10
- Export and Import WSL Linux Distro in Windows 10
- Access WSL Linux Files from Windows 10
- Enable WSL in Windows 10
- Set Default User for WSL in Windows 10
- Windows 10 Build 18836 Shows WSL/Linux File System in File Explorer