Add User to WSL Linux Distro in Windows 10

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.

Linux Distros Microsoft Store Windows 10

Tip: Here's how to tweak your PC to ensure top performance for a specific type of task, be it gaming, document work or something else.

After enabling WSL, you can install various Linux versions from the Store. You can use the following links:

  1. Ubuntu
  2. openSUSE Leap
  3. SUSE Linux Enterprise Server
  4. Kali Linux for WSL
  5. Debian GNU/Linux

and more.

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,

  1. Run your WSL Linux distro, e.g. Ubuntu.Windows 10 WSL Run As User 1
  2. Execute the command sudo adduser <username>.
  3. Substitute the <username> portion with the actual user name you want to create.
  4. Type your current password when prompted.Windows 10 WSL Add User 1
  5. Type a password for this new user account when prompted and hit the Enter key. Re-type the password to confirm the operation.Windows 10 WSL Add User 2
  6. 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.Windows 10 WSL Add User 3
  7. When prompted Is the information correct, type y, and hit Enter key.Windows 10 WSL Add User 4

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: ubuntu config --default-user root
  • openSUSE Leap 42: openSUSE-42 config --default-user root
  • SUSE Linux: SLES-12 config --default-user root
  • Debian: 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.

Related articles.

Driver Updater

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.