This tutorial will show you how to enable or disable the Sudo command for all users in Windows 11.
Starting with Windows 11 build 26052 (Canary and Dev) and and build 26100.712 (RP), Sudo for Windows provides a new way for users to run elevated commands directly from an unelevated console session. It is an ergonomic and familiar solution for users who want to elevate a command without having to first open a new elevated console.
Sudo for Windows is a new way for users to run elevated commands (as an administrator) directly from an unelevated console session. The sudo command can be configured to run in three different modes:
- In a new window: The elevated command runs in a new window. This mode is similar to the behavior of the runas /user:admin command.
- With input disabled: Runs the elevated process in the current window, but with the input handle closed. This means that the elevated process won't be able to receive input from the current console window.
- Inline: Runs the elevated process in the current window and the process is able to receive input from the current console session. This mode is most similar to the sudo experience on other platforms.
Introducing Sudo for Windows!
Introducing Sudo for Windows We’re excited to announce the release of Sudo for Windows in Windows 11 Insider Preview Build 26052! Sudo for Windows is a new way for users to run elevated commands directly from an unelevated console session. It is an ergonomic and familiar solution for users who...
devblogs.microsoft.com
Sudo for Windows
Learn how to use sudo in your command line to run elevated commands (as an administrator) directly from an unelevated console session on Windows.
learn.microsoft.com
You must be signed in as an administrator to enable or disable the Sudo command.
Contents
- Option One: Enable or Disable Sudo Command in Settings
- Option Two: Enable or Disable Sudo Command using Command
- Option Three: Enable or Disable Sudo Command using REG file
EXAMPLE: Sudo for Windows
1 Open Settings (Win+I).
2 Click/tap on System on the left side, and click/tap on For developers on the right side. (see screenshot below)
3 Do step 4 (enable/configure) or step 5 (disable) below for what you want.
4 Enable or Configure Sudo Command
A) Turn On Enable sudo. (see screenshot below)
B) Click/tap on Yes to confirm. (see screenshot below)
C) Select In a new window (default), With input disabled, or Inline for what you want in the Configure how sudo runs applications drop menu. (see screenshot below)
D) Go to step 6.
5 Disable Sudo Command
This is the default setting.
A) Turn Off Enable sudo, and go to step 6. (see screenshot below)
6 You can now close Settings if you like.
1 Open Windows Terminal (Admin), and select either Windows PowerShell or Command Prompt.
2 Copy and paste the command below you want to use into Windows Terminal (Admin), and press Enter.
Enable Sudo command and run apps "In a new window"
sudo config --enable forceNewWindow
OR
Enable Sudo command and run apps "With input disabled"
sudo config --enable disableInput
OR
Enable Sudo command and run apps "Inline"
sudo config --enable normal
OR
Disable Sudo command (default)
sudo config --enable disable
1 Do step 2 (enable - new window), step 3 (enable - input disabled), step 4 (enable - inline), or step 5 (disable) below for what you want.
2. Enable Sudo command and run apps "In a new window"
A) Click/tap on the Download button below to download the file below, and go to step 6 below.
Enable_sudo_in_a_new_window.reg
Download
(Contents of REG file for reference)
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Sudo]
"Enabled"=dword:00000001
3. Enable Sudo command and run apps "With input disabled"
A) Click/tap on the Download button below to download the file below, and go to step 6 below.
Enable_sudo_with_input_disabled.reg
Download
(Contents of REG file for reference)
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Sudo]
"Enabled"=dword:00000002
4. Enable Sudo command and run apps "Inline"
A) Click/tap on the Download button below to download the file below, and go to step 6 below.
Enable_sudo_inline.reg
Download
(Contents of REG file for reference)
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Sudo]
"Enabled"=dword:00000003
5. Disable Sudo command
This is the default setting.
A) Click/tap on the Download button below to download the file below, and go to step 6 below.
Disable_sudo.reg
Download
(Contents of REG file for reference)
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Sudo]
"Enabled"=dword:00000000
6 Save the REG file to your desktop.
7 Double click/tap on the downloaded REG file to merge it.
8 When prompted, click/tap on Run, Yes (UAC), Yes, and OK to approve the merge.
9 You can now delete the downloaded REG file if you like.
That's it,
Shawn Brink
Attachments
Last edited: