In a previous article, we saw how to run a WSL distro as a specific user without setting that account as your default WSL user. In this post, we will learn how to add a new user account to an installed WSL Linux distro 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:
At the first run, a WSL distro offers you to create a new user account. It will be used as your default user account in this distro. Also, it will be added to the sudoers list, a group of users that are allowed to run commands as root (i.e. elevated) by executing the sudo command, e.g.
sudo vim /etc/default/keyboard.
To add an extra user account to WSL, follow the instructions below.
To Add a User to WSL Linux Distro in Windows 10,
- Run your WSL Linux distro, e.g. Ubuntu.
- Execute the command
sudo adduser <username>.
- Substitute the
<username>portion with the actual user name you want to create.
- Type your current password when prompted.
- Type a password for this new user account when prompted and hit the Enter key. Re-type the password to confirm the operation.
- Enter the new value, or leave it blank and press Enter for each value that appears in the console. In Ubuntu, the value list includes Full Name, Room Number, Work Phone, Home Phone, and Other.
- When prompted Is the information correct, type y, and hit Enter key.
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
By replacing 'root' with another user account name in the commands above, you'll set it as your default user account for the distro.
- 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