No more “Run as Administrator” – Windows 11 (24H2+) now supports sudo, just like Unix /Linux systems! This means you can execute privileged commands with ease, right from the console. Want to know how to set it up?
Microsoft recently introduced the famous command “sudo” from Unix and Linux-based systems to Windows 11. Before that, Windows users used to rely on alternatives like “Run as Administrator” to perform tasks that required admin privileges.
What is sudo in Windows?
“sudo” in Windows enables users to run privileged commands directly without requiring the reopening of a privileged console session. Currently, sudo is only available on Windows 11, version 24H2 and higher. While it’s not supported on Windows 10 right now, Microsoft may eventually add it in a future update.
How to Enable sudo in Windows
You can enable sudo on Windows either via GUI or a privileged console session. Let’s check both methods one after one.
Method 1: Enabling sudo for Windows via GUI
In this method, we are going to utilize Windows GUI to enable sudo.
Step 1: Open System Settings
- First, hit the start menu icon and open Settings.
- After that, click on “System” and then on “For developers”.
Step 2: Enable sudo for Windows
Turn on the “Enable sudo” toggle button:
Method 2: Enabling sudo for Windows via Console
While most Windows users prefer doing their tasks by using GUI, some of them want to via console.
To enable sudo using the console follow the procedure below:
Step 1: Open privileged Console session
As the first step, you need to launch a privileged Windows console session:
Step 2: Enable sudo
Now, execute the mentioned command while providing the configuration option for enabling sudo:
sudo config --enable config_opt
Note: Replace “config_opt” with one of these:
- normal (Inline)
- forceNewWindow (In a New Window)
- disableInput (Input Closed)
Configuring sudo for Windows
The sudo command in Windows comes with three configuration options which can be switched using the command line or system settings.
Below are the currently available configuration options:
1. In a New Window
It is the default configuration option. Executing the sudo command with this configuration option will open a new privileged console and execute the command there.
2. Input Closed
This option runs the privileged process in the same window and closes the input handle to prevent receiving input from the console.
3. Inline
The configuration option “Inline” executes the process in the same window and also allows it to receive input from the active console.
How do we use sudo in Windows?
If you want to run any command as a privileged one, then simply add “sudo” before it. Here is a simple example to illustrate the process. Suppose you want to create a directory at a protected location via the console. Without “sudo” you will get a response of “Access is denied”:
Below is the result of doing the same process with “sudo”:
Conclusion
sudo on Windows lets its users execute privileged commands without launching a console session with admin privileges. This update is exclusively available for Windows 11, version 24H2 or newer. However, this command might be introduced in Windows 10 sooner.
To enable sudo on Windows via GUI, go to system settings and turn the “Enable sudo” button on. You can also enable it using a privileged console session. To do so, run this command “sudo config –enable config_opt” and replace “config_opt” with either of these, normal, forceNewWindow, and disableInput.