Run WSL Linux Distro as Specific User in Windows 10

In a previous article, we reviewed the methods you can use to start a WSL Linux Distro in Windows 10, including the classic shortcuts in the Start menu, and ending the wsl.exe console tool. In this article, we will see how to run a distro as a specific user without setting that account as your default WSL user.

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.

Windows 10 offers two methods to start a WSL distro. For distros installed from the Store, you can use either the console wls.exe tool, or a Start menu shortcut. For imported WSL distros, Windows 10 does not create Start menu shortcuts as of this writing, so you are limited to wsl.exe only. Also, if you need to run as distro as a specific user, you have to use wsl.exe. Here's how it can be done.

To Run a WSL Linux Distro as a Specific User in Windows 10,

  1. Open a new command prompt or PowerShell instance.
  2. To run your default WSL distro, type wsl--u <Username> or wsl --user <Username> and hit the Enter key. Substitute the <Username> portion with the actual user name that exists in your default Linux distro.Windows 10 WSL Run As User 1
  3. To start a specific distro, find available WSL distros by executing the following command: wls --list --all, or simply wsl -l --all.Windows 10 List WSL Distros
  4. To start a specific distro, type the command wsl --user <Username> --distribution <DistributionName> or wsl -u <Username> -d <DistributionName>. Replace the <DistributionName> portion with the actual name of the installed distro you want to run, e.g. kali-linux.
  5. Substitute the <Username> portion with the actual user name that must exist in your default Linux distro.Windows 10 WSL Run As User 2

That's it.

Leave a Reply

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