How to Add User to Windows Subsystem for Linux (WSL) Distro in Windows 10


The Windows Subsystem for Linux (WSL) is a new Windows 10 feature that enables you to run native Linux command-line tools directly on Windows, alongside your traditional Windows desktop and modern store apps.

When you have Windows Subsystem for Linux (WSL) enabled, you can install WSL distro apps from the Microsoft Store, and export and import WSL distros.

The first time a newly installed WSL distro runs, a Console window will open, and you'll be asked to wait for a minute or two for the installation to complete.

Once installation is complete, you will be prompted to create a new user account (and its password).

Creating your Linux user is the first step in setting up a new Linux distribution on WSL. The first user account you create is automatically configured with a few special attributes:
  1. It is your default user -- it signs-in automatically on launch.
  2. It is Linux administrator (a member of the sudo group) by default.

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 10 user account.

When you add a user to a WSL distro, this new user will not be a member of the sudo (aka: administrator) group by default.

This tutorial will show you how to add a new user to a Windows Subsystem for Linux (WSL) distro in Windows 10.


 CONTENTS:

  • Option One: Add User to a WSL Distro while signed in as a Sudu User
  • Option Two: Add User to a WSL Distro while signed in as Root





Add User to Windows Subsystem for Linux (WSL) Distro in Windows 10 OPTION ONE Add User to Windows Subsystem for Linux (WSL) Distro in Windows 10
Add User to a WSL Distro while signed in as a Sudu User

You must be signed in to the WSL distro as a sudo user to do this option.

1. Open the WSL distro (ex: "Ubuntu") you want to add a user to.

2. Type the command below into the WSL distro (ex: "Ubuntu") console, and press Enter. (see screenshot below step 5)

sudo adduser <username>

Substitute <username> in the command above with the actual user name (ex: "brink2") you want for the new user.

For example: sudo adduser brink2

3. When prompted, enter the password of the currently signed in sudo user (ex: "brink"), and press Enter. (see screenshot below step 6)

4. When prompted: (see screenshot below step 6)
  • Enter new UNIX password for the new user.
  • Retype new UNIX password to confirm for the new user.

5. When prompted, enter the new value and press Enter or leave blank and press Enter for what you want for each value below for the new user. (see screenshot below step 6)
  • Full Name []
  • Room Number []
  • Work Phone []
  • Home Phone []
  • Other []

6. When prompted Is the information correct, type y, and press Enter. (see screenshot below)

Name:  Add_user_to_WSL_distro_as_sudo.png
Views: 163
Size:  16.3 KB






Add User to Windows Subsystem for Linux (WSL) Distro in Windows 10 OPTION TWO Add User to Windows Subsystem for Linux (WSL) Distro in Windows 10
Add User to a WSL Distro while signed in as Root

1. Open a command prompt or PowerShell.

2. Copy and paste the command below into the command prompt or PowerShell for the WSL distro name (ex: "Ubuntu") you want to add a new user to, and press Enter. Leave this command prompt or PowerShell open. (see screenshot below)

This command will change the default user to root for the WSL distro (ex: "Ubuntu").

(Ubuntu)
ubuntu config --default-user root

OR

(openSUSE Leap 42)
openSUSE-42 config --default-user root

OR

(SUSE Linux)
SLES-12 config --default-user root

OR

(Debian)
debian config --default-user root

OR

(Kali Linux)
kali config --default-user root

Name:  Set_WSL_distro_default_user_to_root.png
Views: 193
Size:  4.1 KB

3. Run the WSL distro name (ex: "Ubuntu") you want to add a new user to.

4. Type the command below into the WSL distro (ex: "Ubuntu") console, and press Enter. (see screenshot below step 7)

adduser <username>

Substitute <username> in the command above with the actual user name (ex: "brink2") you want for the new user.

For example: adduser brink2

5. When prompted: (see screenshot below step 7)
  • Enter new UNIX password for the new user.
  • Retype new UNIX password to confirm for the new user.

6. When prompted, enter the new value and press Enter or leave blank and press Enter for what you want for each value below for the new user. (see screenshot below step 7)
  • Full Name []
  • Room Number []
  • Work Phone []
  • Home Phone []
  • Other []

7. When prompted Is the information correct, type y, and press Enter. (see screenshot below)

Name:  Add_user_to_WSL_distro.png
Views: 197
Size:  12.9 KB

8. Type the command below into the command prompt or PowerShell from step 2 for the user name (ex: "brink") you want to be the default user of this WSL distro (ex: "Ubuntu"), and press Enter. (see screenshot below)

(Ubuntu)
ubuntu config --default-user <username>

OR

(openSUSE Leap 42)
openSUSE-42 config --default-user <username>

OR

(SUSE Linux)
SLES-12 config --default-user <username>

OR

(Debian)
debian config --default-user <username>

OR

(Kali Linux)
kali config --default-user <username>

Substitute <username> in the command above with the actual UNIX username (ex: "brink") you want to be the default user for this WSL distro.

For example: ubuntu config --default-user brink

9. When finished, you can close the WSL distro and command prompt or PowerShell if you like.

Name:  Set_WSL_distro_default_user_to_user.png
Views: 195
Size:  4.3 KB


That's it,
Shawn


Related Tutorials