Advertisement

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.

Advertisеment

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

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.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Advertisеment

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

One thought on “Add User to WSL Linux Distro in Windows 10”

  1. Without guidance on working with Windows users (domain or local users) this article seems pointless. Why am I not just reading about this article on one of the Ubuntu web pages?

Leave a Reply

Your email address will not be published.

css.php
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.