Enable Sudo Command on Windows 11: Sudo originated in Unix and Linux Systems, and it is similar to the Administrator on Windows 11. Microsoft has recently introduced a native version of sudo in Windows 11, which provides similar functionality by letting users elevate commands directly from a normal console. In this article, let's check out the various methods to Enable Sudo Command on Windows 11.
How Does the Sudo Command Work?
Sudo is short for Superuser do. Initially, Unix and Linux-based systems operated fully on Command Line Interfaces, and unlike assigning an entire administrative account to the root user on Windows Operating systems, Unix and Linux systems allow users to safely execute specific commands that require elevated permissions using the sudo command.
Microsoft took it a step further by integrating the Sudo Command with User Account Control; in this way, it does not rely on passwords or user roles like Linux operating systems do. This makes it a convenient tool for developers and power users to run administrative commands more easily, while still maintaining the security model of Windows. Let's get started.
A superuser, usually called Root User, is the highest-level user on a system, the one with the ability to do anything, including tasks that could fix or break the system. It has unrestricted access to all commands, files, processes, settings, and more.
How to Enable Sudo Command on Windows 11?
Before enabling the sudo command on Windows 11, there are some prerequisites, as it is a newly introduced feature on Windows 11.
- Operating System: Windows 11
- Build Version: 24H2
- Administrative Privileges needed: Yes
Note: Please make a note that the Sudo Command option is not available on the previous Windows 11 Builds. Hence, make sure you are on the 24H2 Build of Windows 11 to enable this feature.
Windows 11 allows commands to run with elevated administrator privileges, which can affect critical system files and settings. Users should exercise caution, ensure you fully understand any command you execute, and avoid running untrusted scripts or programs. This feature relies on User Account Control (UAC) for confirmation, but misuse or incorrect commands can still cause system instability, data loss, or security vulnerabilities. It is recommended to use sudo sparingly, follow best practices. Use this feature at your own risk as "Enable Sudo feature" in Windows 11 is primarily intended for developers and advanced users
Different Methods to Enable Sudo Command on Windows 11
- Enable Sudo on Windows 11 using the Windows Settings.
- Turn on the Sudo Command using the Command Prompt or Windows PowerShell.
Enable Sudo Command on Windows 11 using the Windows Settings [GUI Method]
- Go to the Windows Settings using the keyboard shortcut WinKey + I.
- In the Windows Settings, from the left pane, click on System.
- Under System Settings, scroll down and locate Advanced, and open Advanced Settings.
- You can find the Enable Sudo option under Terminal. Turn it on to enable the Sudo Command on Windows 11.
- User Account Control will prompt for your confirmation. Choose accordingly. That's it - Sudo Command will now be enabled on your Windows 11.
- Once Sudo is enabled on your Windows 11, you can configure how Sudo runs applications.
- You can choose between In a new window, With input disabled, and Inline.
Turn on the Sudo Command on Windows 11 using the Command Prompt or Windows PowerShell [CLI Method]
In this method, we will use the Command Line Interface via the Command Prompt or Windows PowerShell. For explanation, we will use Windows PowerShell.
To enable Sudo Command on Windows 11 via the Command Prompt or Windows PowerShell, we have to run them with Administrative Privileges.
-
Go to the Run Command using the keyboard shortcut WinKey + R. In the Run, type the following command
powershell
and press CTRL + SHIFT + ENTER. -
This will prompt the system to run the
powershell
command with Elevated Privileges. UAC will confirm and open Windows PowerShell with Elevated Permissions. -
sudo config --enable (mode)
is the syntax. Here, mode is the sudo configuration option. You can specify which one you are going to use. You can choose between In a New Window, With Input Disabled, and Inline. For explanation, we will use the option "In a New Window". Execute the following command in Windows PowerShell.sudo config --enable forceNewWindow
- This command will enable sudo and set its configuration to "In a New Window". You can execute the same command in the Command Prompt as well.
- One interesting thing is that in Windows Settings, the default option refers to the safest option, "In a New Window". However, in the CLI mode, with PowerShell or CMD, the default option refers to the Inline Mode. This difference in behavior is due to contextual awareness. The Windows Settings favors the safety of the general users, whereas the CLI modes favor the convenience of the developers. Here are the possible sudo configurations you can enable using Windows PowerShell or Command Prompt.
Value |
Behavior |
---|---|
forceNewWindow |
Enables Sudo with In a New Window configuration |
normal/default |
Enables Sudo with Inline Configuration |
disableInput |
Runs Elevated Commands inline, but blocks additional user input |
Take Away
Introducing the Sudo Command on Windows 11 bridges the gap between Windows and Linux and allows users and developers to run elevated commands directly from their console. However, running the Sudo Command could expose your device and personal data to security risks or harm your device. Hence, use Sudo wisely.