Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

How to Set Root as Default User for WSL Instances

July 25, 2024
in A, Blog, WSL
0
ADVERTISEMENT

Table of Contents

Set Root as Default User for WSL Instances

The default UNIX user is the user account that appears signed in when you open the appropriate Linux console. By default, it opens with the username that you’ve specified during the initial setup of the feature.

PS C:\> wsl --install -d ubuntu
Ubuntu is already installed.
Launching Ubuntu...
Installing, this may take a few minutes...
Please create a default UNIX user account.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: bonben
New password:
Retype new password:
passwd: password updated successfully
The operation completed successfully.

Every time when you ran a commend need the administrative right, you need to enter the password of the current logged on user.

Be8e3MqEy3vihzOuMur3rf5WnZWJGJUpigbwKr9eUn3dnv6eVHGXpRWiVD5j

To bypass this, you can set the root user as the default user for the WSL instances.

1. Get the list of installed WSL instances. In PowerShell run wsl -l -v command:

PS C:\> wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Stopped         2
  Debian    Stopped         2

2. To set the default root user for Ubuntu in WSL, run the command. Substitute the ubuntu portion with the name of your WSL instance. In my case, it is ubuntu.

ubuntu config --default-user root

As you can see, from now, when you launch the Ubuntu instance, the root account would be used by default. The Linux console will open with this user.

K27cttaxRhcC5ccwrJHkxNGW8lkmlPMXnhZdcVlYwZtvkoIoMGOuQ05iwb5k

If you are using Debian, run the following command:

debian config --default-user root
qNy1h3tmX0HX0j3yWMsc8dHdHz5jGEDnuvJRFhAXxNX1UPMTeeOXTAufebqX

Tip: The binary file name of other distros can be found with Task Manager. Open the Windows Task Manager → Select the Details tab → Then Search for Linux. See the following screenshot.

BANRwzt8KC3eMNIDGqEgytU4fRuWoZRE4kathHPHxLq9ITMnoeRldJRBOzy5
ADVERTISEMENT

Not a reader? Watch this related video tutorial:

5/5 - (1 vote)
Previous Post

How to Always Run VS Code as an Administrator

Next Post

How to Run Multiple Instances of the Same Linux Distro on WSL

Related Posts

Images Hidden Due To Mature Content Settings In CivitAI

August 31, 2024

Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

August 20, 2024

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024

How to Remove The Test Mode Watermark Without Disabling Test Mode

July 28, 2024

Leave a Reply Cancel reply

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

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory