Windows 10: Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10

Discus and support Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10 in Windows 10 Tutorials to solve the problem; How to: Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10 How to Add, Remove, and List Sudo Users in Windows Subsystem for Linux... Discussion in 'Windows 10 Tutorials' started by Brink, Jun 4, 2018.

  1. Brink Win User

    Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10


    How to: Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10

    How to Add, Remove, and List Sudo Users 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 export and import WSL distros.

    The first time a newly installed WSL distro 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 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, remove, and list users of the sudo group in a Windows Subsystem for Linux (WSL) distro in Windows 10.


    CONTENTS:
    • Option One: List All Sudo Users in a WSL Distro
    • Option Two: Add User to Sudo Group in a WSL Distro while signed in as Root
    • Option Three: Add User to Sudo Group in a WSL Distro while signed in as a Sudu User
    • Option Four: Remove User from Sudo Group in a WSL Distro while signed in as Root
    • Option Five: Remove User from Sudo Group in a WSL Distro while signed in as a Sudu User




    OPTION ONE [/i] List All Sudo Users in a WSL Distro
    1. users that are currently a member of the sudo group in this WSL distro.

    2. Copy and paste either command below into the WSL distro console, and press Enter. (see screenshots below)
    *Arrow grep '^sudo:.*$' /etc/group | cut -d: -f4

    OR

    *Arrow getent group sudo | cut -d: -f4

    OR

    *Arrow grep -Po '^sudo.+:\K.*$' /etc/group
    3. You will now see a list of all users that are currently a member of the sudo group in this WSL distro. Each user will be separated by a comma.

    *tip You can compare this list of sudo users to the users[/b] are not currently a member of the sudo group.


    Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10 [​IMG]


    Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10 [​IMG]


    Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10 [​IMG]






    OPTION TWO [/i] Add User to Sudo Group in a WSL Distro while signed in as Root
    1. user to the sudo group for this WSL distro.

    2. Type the command below into the WSL distro console, and press Enter. (see screenshot below)
    *Arrow gpasswd -a <username> sudo

    *note Substitute <username> in the command above with the actual user (ex: "brink2") you want to add as a member of the sudo group for this WSL distro.

    For example: gpasswd -a brink2 sudo


    Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10 [​IMG]






    OPTION THREE [/i] Add User to Sudo Group in a WSL Distro while signed in as a Sudu User
    1. user to the sudo group for this WSL distro.

    2. Type the command below into the WSL distro console, and press Enter. (see screenshot below)
    *Arrow sudu gpasswd -a <username> sudo

    *note Substitute <username> in the command above with the actual user (ex: "brink2") you want to add as a member of the sudo group for this WSL distro.

    For example: sudu gpasswd -a brink2 sudo

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

    *note This will not be the password of the user (ex: "brink2") you want to add as a member of the sudo group.


    Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10 [​IMG]






    OPTION FOUR [/i] Remove User from Sudo Group in a WSL Distro while signed in as Root
    1. user from the sudo group for this WSL distro.

    2. Type the command below into the WSL distro console, and press Enter. (see screenshot below)
    *Arrow gpasswd -d <username> sudo

    *note Substitute <username> in the command above with the actual user (ex: "brink2") you want to remove as a member of the sudo group for this WSL distro.

    For example: gpasswd -d brink2 sudo


    Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10 [​IMG]






    OPTION FIVE [/i] Remove User from Sudo Group in a WSL Distro while signed in as a Sudu User
    1. user from the sudo group for this WSL distro.

    2. Type the command below into the WSL distro console, and press Enter. (see screenshot below)
    *Arrow sudu gpasswd -d <username> sudo

    *note Substitute <username> in the command above with the actual user (ex: "brink2") you want to remove as a member of the sudo group for this WSL distro.

    For example: sudu gpasswd -d brink2 sudo

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

    *note This will not be the password of the user (ex: "brink2") you want to remove as a member of the sudo group.


    Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10 [​IMG]


    That's it,
    Shawn


    Related Tutorials

    :)
     
    Brink, Jun 4, 2018
    #1

  2. Alternatives to using Windows Store to install Linux distro on WSL

    I just wanted to ask what alternatives there are to using the Windows 10 to install Linux distros on WSL.

    Also, it seems like Ubuntu 19 isn't available for the WSL. Is there a chance that we'll be able to install it when WSL2 is released? And I'd like to get the latest non-LTS version if possible (though it's alright if it's not possible too).
     
    OsmanZakir, Oct 27, 2019
    #2
  3. Brink Win User
    Sideloading Custom Linux Distro to Windows 10 Subsystem for Linux

    Source: Open Sourcing a WSL Sample for Linux Distribution Maintainers and Sideloading Custom Linux Distributions Windows Command Line Tools For Developers
     
    Brink, Oct 27, 2019
    #3
  4. Brink Win User

    Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10

    Sideloading Custom Linux Distro to Windows 10 Subsystem for Linux


    Source: Open Sourcing a WSL Sample for Linux Distribution Maintainers and Sideloading Custom Linux Distributions Windows Command Line Tools For Developers
     
    Brink, Oct 27, 2019
    #4
  5. Resolving WslRegisterDistribution error 0x80370102 when installing Linux Distro for WSL 2?

    # Encountering WslRegisterDistribution error 0x80370102 when installing Linux Distro for WSL 2

    I am currently on the `Windows 10 Pro Insider Preview build 18922.rs_prerelease`, and am trying to install a Linux distribution to access via Windows Subsystem for Linux (2). I have tried this for both the Ubuntu and Debian distros and have encountered the
    same error in each.

    I have successfully downloaded both distros from the Microsoft store, but when I try to first "run" the Ubuntu or Debian "app" the respective console comes up and prints the following text:

    Code:
    Installing, this may take a few minutes...
    
    WslRegisterDistribution failed with error: 0x80370102
    
    Error: 0x80370102 The virtual machine could not be started because a required feature is not installed.
    
    Press any key to continue...
    Pressing a key at this point automatically exits the console.
    ---

    ## Additional information:

    - Using the `wsl -l` command shows no installed distros.

    - I do have Hypervisor installed and running `bcdedit` does show that `hypervisorlaunchtype` is set to `Auto` in the `Windows Boot Loader` section.

    - I did previously have Ubuntu installed and working under WSL 1 before switching to the Windows Insider Program Fast Ring and gaining access to WSL 2, but I was encountering another issue when trying to have it use WSL 2. After
    trying to use the command `wsl --set-version Ubuntu 2` I was met with a request to "Enable the Virtual Machine Platform". I had already run `Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform` prior, according to the official microsoft
    tutorial here Install WSL 2, but for good measure I did it again and got the same error, and Ubuntu was still on version 1 (I haven't explicitly mentioned it but I was restarting/shutting down when requested/suggested
    by windows and tutorials, so I don't believe me not restarting is a cause). In hopes to find a workaround, I ended up uninstalling Ubuntu and hoping I could reinstall it and have it obey the default defined by the `wsl --set-default-version 2` command (suffice
    it to say, this did not go as I'd hoped).

    - This might be an unrelated issue, but when I initially attempted reinstalling Ubuntu, the Microsoft store had a bit of a fit and could not complete the download- encountering an 'unknown error'. I did a restart, tried again, and
    got the same error, but then after telling it to 'try again' it succeeded. I had no such issues installing Debian from the store.

    ---

    ## Suggestions Welcome

    I've searched for a bit and can't find mention of this error code in particular anywhere else.

    In addition, is there anywhere I can look up/access these error codes in any sort of documentation? Ideally so I can make a better informed work-around attempt before bothering you all on here.

    All help is appreciated!
     
    SamuelLudwig, Oct 27, 2019
    #5
  6. johngalt Win User
    johngalt, Oct 27, 2019
    #6
Thema:

Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10

Loading...
  1. Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10 - Similar Threads - Add Remove List

  2. How to add users to WSL Distro (Windows Subsystem for Linux)

    in Windows 10 News
    How to add users to WSL Distro (Windows Subsystem for Linux): [ATTACH] [ATTACH]WSL or Windows Subsystem for Linux for Windows 10 support multiuser capabilities. And when it comes to user management for software, various aspects of software management can be discussed. Adding a user to the Windows Subsystem for Linux on Windows [...]...
  3. Remove User from Windows Subsystem for Linux WSL Distro in Windows 10

    in Windows 10 Tutorials
    Remove User from Windows Subsystem for Linux WSL Distro in Windows 10: How to: Remove User from Windows Subsystem for Linux WSL Distro in Windows 10 How to Remove User from 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...
  4. Switch User in Windows Subsystem for Linux (WSL) Distro in Windows 10

    in Windows 10 Tutorials
    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 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...
  5. List Users in Windows Subsystem for Linux (WSL) Distro in Windows 10

    in Windows 10 Tutorials
    List Users in Windows Subsystem for Linux (WSL) Distro in Windows 10: How to: List Users in Windows Subsystem for Linux (WSL) Distro in Windows 10 How to List Users 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...
  6. Add User to Windows Subsystem for Linux (WSL) Distro in Windows 10

    in Windows 10 Tutorials
    Add User to Windows Subsystem for Linux (WSL) Distro in Windows 10: How to: Add User to Windows Subsystem for Linux (WSL) Distro in Windows 10 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...
  7. Unregister Windows Subsystem for Linux (WSL) Distro in Windows 10

    in Windows 10 Tutorials
    Unregister Windows Subsystem for Linux (WSL) Distro in Windows 10: How to: Unregister Windows Subsystem for Linux (WSL) Distro in Windows 10 How to Unregister and Reset 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...
  8. Install Windows Subsystem for Linux (WSL) Distros in Windows 10

    in Windows 10 Tutorials
    Install Windows Subsystem for Linux (WSL) Distros in Windows 10: How to: Install Windows Subsystem for Linux (WSL) Distros in Windows 10 How to Install Windows Subsystem for Linux (WSL) Distros 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...
  9. Run Windows Subsystem for Linux (WSL) Distro in Windows 10

    in Windows 10 Tutorials
    Run Windows Subsystem for Linux (WSL) Distro in Windows 10: How to: Run Windows Subsystem for Linux (WSL) Distro in Windows 10 How to Run a 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...
  10. List All Windows Subsystem for Linux (WSL) Distros in Windows 10

    in Windows 10 Tutorials
    List All Windows Subsystem for Linux (WSL) Distros in Windows 10: How to: List All Windows Subsystem for Linux (WSL) Distros in Windows 10 How to List All Available Windows Subsystem for Linux (WSL) Distros in Windows 10 The Windows Subsystem for Linux (WSL) is a new Windows 10 feature that enables you to run native Linux command-line...