Microsoft is introducing the sudo command, a popular Linux feature, to Windows 11. This command allows users to run programs with elevated privileges, similar to the "Run as Administrator" option in Windows. Here's a quick guide to enable and use Sudo in Windows 11.

Enabling Sudo from Windows Settings

Before you can start using Sudo, you need to enable it. Follow these simple steps to get started:

  1. Ensure you're running Windows 11 Insider Preview Build 26052 or higher. If you're not, update your system.
  2. Press the Windows key + I to open the Settings app.
  3. Go to System > For Developers.
  4. Find the 'Enable Sudo' option and toggle it to On.
  5. Click 'Yes' on the confirmation window.
0:00
/0:19

Enabling Sudo for Windows from Settings

Enabling Sudo from Command Prompt

Alternatively, you can also enable sudo from the terminal (admin) with the following command:

  1. Right-click on the Start menu and select 'Terminal (admin)' to launch command prompt with administrator privileges.
  2. Type or paste sudo config --enable enable into the terminal and hit Enter.
0:00
/0:10

Enabling Sudo for Windows from Command Prompt

Note: Enabling Sudo for Windows can pose security risks if not configured properly. Ensure you understand these risks before proceeding.

Configuring Sudo for Windows

Sudo for Windows offers three configuration options to suit different needs. You can select your preferred configuration from the same For Developers menu in Settings or use the command line for more flexibility. Here are the options:

  • In a New Window (forceNewWindow): This is the default setting when enabling Sudo from Windows Settings. When used, commands run in a new, elevated window.
  • Input Closed (disableInput): Runs the command in the current window but without accepting input, mitigating security risks.
  • Inline (normal): Runs the command in the current window, allowing input. This mode is similar to traditional Sudo behavior but poses more security risks. Also, this is the default setting when you enable sudo from the command prompt.

To change the configuration via the command line, use the following syntax:

sudo config --enable <configuration_option>

Replace <configuration_option> with either forceNewWindow, disableInput, or normal.

Using Sudo for Windows

With Sudo enabled and configured, you can start running elevated commands easily.

  1. Launch your preferred console window, such as Command Prompt or Windows Terminal.
  2. Prepend sudo to any command you wish to run with elevated privileges. For example:

sudo netstat -ab

  1. A GUI prompt will appear asking for verification to proceed with the elevated command. Hit Enter and the command will be executed as per the defined sudo configuration setting.

Security Considerations. Using Sudo in the disableInput or inline configurations can introduce security vulnerabilities, as malicious processes might exploit the elevated process. Always be cautious and understand the risks before choosing your configuration.


Conclusion. Sudo for Windows brings a familiar and powerful tool to Windows 11, simplifying the process of running commands with elevated privileges. By following this guide, you can enable, configure, and start using Sudo in Windows 11 with ease. Remember to consider the security implications of your chosen configuration and stay updated on any changes as Windows continues to evolve.

For more advanced features, consider third-party alternatives like Gerardo Grignoli’s gsudo, which offers additional configuration options.