Switch User in Windows Subsystem for Linux (WSL) Distro in Windows 10  

    Switch User in Windows Subsystem for Linux (WSL) Distro in Windows 10

    Switch User in Windows Subsystem for Linux (WSL) Distro in Windows 10

    How to Switch User in Windows Subsystem for Linux (WSL) Distro in Windows 10
    Published by Category: Apps & Features
    07 Mar 2019
    Designer Media Ltd


    How to Switch User in 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.

    If you like, you can switch to a specified user at any time in a WSL distro console.

    This tutorial will show you how to switch between users in a Windows Subsystem for Linux (WSL) distro console in Windows 10.

    You will not be able to switch to root in a WSL distro in Windows 10. To run a command as administrator (user "root"), use "sudo <command>". You could also set the default user to root for a WSL distro.



    Here's How:

    1. Run the WSL distro (ex: "Ubuntu") you want.

    2. Type either command below into the WSL distro console, and press Enter. (see screenshot below)

    su - <username>

    OR

    su -l <username>

    OR

    su --login <username>

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

    For example: su - brink

    3. When prompted, enter the password of the user (ex: "brink2") you want to switch to, and press Enter.

    Name:  Switch_User_in_WSL_distro.png
Views: 163
Size:  6.4 KB


    That's it,
    Shawn


    Related Tutorials



  1.    #1

    I honestly do not know If Ubuntu in WSL is different than Ubuntu, but it is not advisable to use root as default user, root is a super user that can damage the system if not suitably used, in ubuntu (and in Linux in general) root is different from the default system administrator (here above defined as defaul-user).
    It may not be a problem (?) if you use root ubuntu in WSL, but it will be a problem using a regular Ubuntu. HTH.
      My ComputerSystem Spec

  2. Brink's Avatar
    Posts : 37,971
    64-bit Windows 10 Pro build 18865
    Thread Starter
       #2

    Agreed. Just like not wanting to use the built-in Administrator for an everyday account in Windows, it's not advisable to always have root as the default user in a WSL distro.
      My ComputersSystem Spec


 

Tutorial Categories

Switch User in Windows Subsystem for Linux (WSL) Distro in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


Related Threads
How to Set Default User for 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...
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...
How to Reset User Password in 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...
How to Export and Import 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...
Source: Open Sourcing a WSL Sample for Linux Distribution Maintainers and Sideloading Custom Linux Distributions Windows Command Line Tools For Developers
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 23:12.
Find Us