Tech News

Microsoft Introduces Sudo for Windows 11: A Linux-like Command with Elevated Privileges

Microsoft has recently unveiled an exciting addition to its Windows 11 operating systemSudo for Windows. This new feature allows users to run elevated commands directly from an unelevated console session, similar to the popular sudo command in Linux. With Sudo for Windows, users can execute commands with administrator privileges without the need to open a new elevated console. In this article, we will explore the details of this new functionality, including its prerequisites, how to enable and configure it, and its various security considerations.

Prerequisites for Sudo for Windows

To take advantage of Sudo for Windows, users need to ensure that they are running Windows 11 Insider Preview Build 26052 or higher. If you meet this requirement, you can easily enable Sudo for Windows by following a simple process.

Enabling Sudo for Windows

Enabling Sudo for Windows is straightforward. Simply navigate to the Settings menu in Windows and select For Developers. From there, you can toggle the Enable sudo option to On. It’s important to note that this feature is currently available only for Windows 11 builds and not for Windows 10. However, there may be plans to extend support to Windows 10 in the future.

Configuring Sudo for Windows

Sudo for Windows offers three different configuration options to suit various user preferences and security requirements. These configurations can be set either through the Settings menu or programmatically using the command line. Let’s explore each option:

1. In a New Window (forceNewWindow)

The forceNewWindow configuration option is the default for Sudo for Windows. When using this option, running a command with sudo will open a new console window to execute the command. This behaviour closely resembles the functionality of the runas /user:admin command. Users who prefer the familiarity of this method will find it convenient to run commands as administrators.

2. Input Closed (disableInput)

The disableInput configuration option allows the elevated process to run in the current window, but with the input handle closed. This means that the elevated process will not receive input from the current console window. Users may choose this option when running a command as an administrator but do not want the command to interact with the current console window. This option provides convenience while mitigating potential security risks.

3. Inline (normal)

The normal configuration option closely resembles the behaviour of sudo on other operating systems. When using this option, the elevated process runs in the current window and can receive input from the current console session. This option is suitable for scenarios where users want to run a command as an administrator and allow it to interact with the current console window. However, it’s important to be aware of the associated security risks before choosing this option.

You can easily select and change among these configurations from the Settings > For Developers menu or programmatically using the command:

sudo config --enable <configuration>

Replace <configuration> with the desired option: forceNewWindow, disableInput, or normal.

Promoted contents:

Using Sudo for Windows

Once Sudo for Windows is enabled and configured, it’s easy to use. Simply prepend sudo to the command you want to run as an administrator. For example, to run the command netstat -ab as an administrator, you would enter sudo netstat -ab in your console window. When running a command with sudo, a prompt will open asking for verification before proceeding with elevated privileges.

Security Considerations

While Sudo for Windows offers convenience and flexibility, it’s important to consider the security implications of using this feature. Microsoft provides documentation that highlights the associated risks and mitigation strategies for each configuration option.

In particular, the Input Closed and Inline configurations introduce potential risks. Malicious processes could attempt to manipulate the elevated process using the connection established by the unelevated sudo.exe and the elevated sudo.exe process. To mitigate this risk, the disableInput configuration closes the input handle, preventing unelevated processes from sending input to the elevated process. The inline configuration, on the other hand, allows communication between the elevated and unelevated processes within the same console window.

As with any security-related feature, it’s crucial to carefully evaluate the risks and select the appropriate configuration option based on your specific requirements and understanding of the potential vulnerabilities.

Open Source Initiative

In a commendable move, Microsoft has announced its plan to open source Sudo for Windows on GitHub. By doing so, they invite other users to contribute to the project and provide feedback, ensuring that it evolves based on community needs. This initiative will not only enhance the functionality of Sudo for Windows but also foster collaboration and innovation within the developer community.

Conclusion

With the introduction of Sudo for Windows in Windows 11, Microsoft brings the power and convenience of the sudo command from the Linux world to Windows users. This feature allows users to execute commands with elevated privileges directly from an unelevated console session. By enabling and configuring Sudo for Windows, users can choose their preferred method of running commands as administrators. However, it’s essential to carefully consider the security implications of each configuration option to ensure the integrity of your system.

Microsoft’s decision to open source Sudo for Windows further demonstrates their commitment to collaboration and community-driven development. With the active involvement of users and developers, Sudo for Windows is poised to evolve and provide even more value to Windows users in the future.

Stay tuned for updates on the GitHub repository for Sudo for Windows, and be sure to contribute and provide feedback to help shape the future of this exciting feature. With Sudo for Windows, Microsoft continues to bridge the gap between different operating systems, empowering users with enhanced control and flexibility in their command-line experience.

Back to top button

Adblock Detected!

Hello, we detected you are using an Adblocker to access this website. We do display some Ads to make the revenue required to keep this site running. please disable your Adblock to continue.