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:
- Ensure you're running Windows 11 Insider Preview Build 26052 or higher. If you're not, update your system.
- Press the
Ito open the Settings app.
- Go to
System > For Developers.
- Find the 'Enable Sudo' option and toggle it to On.
- Click 'Yes' on the confirmation window.
Enabling Sudo from Command Prompt
Alternatively, you can also enable sudo from the terminal (admin) with the following command:
- Right-click on the Start menu and select 'Terminal (admin)' to launch command prompt with administrator privileges.
- Type or paste
sudo config --enable enableinto the terminal and hit
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>
<configuration_option> with either
Using Sudo for Windows
With Sudo enabled and configured, you can start running elevated commands easily.
- Launch your preferred console window, such as Command Prompt or Windows Terminal.
sudoto any command you wish to run with elevated privileges. For example:
sudo netstat -ab
- A GUI prompt will appear asking for verification to proceed with the elevated command. Hit
Enterand the command will be executed as per the defined sudo configuration setting.
Security Considerations. Using Sudo in the
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.