You can now find Cyber Kendra on Google News!

Microsoft Open Sources Sudo for Windows

Download Sudo for Windows

Microsoft has exciting news for Windows developers and power users - they have open sourced the code for Sudo for Windows!

Sudo (superuser do) is a popular tool on Linux and Unix systems that allows users to run commands with elevated/administrator privileges from a non-elevated terminal session.

What is Sudo for Windows?

Recently introduced in Windows 11 Insider Preview Build 26052, Sudo for Windows brings a similar functionality to run elevated commands directly from an unelevated command prompt or PowerShell window with just the sudo prefix.

Instead of having to start a new admin terminal every time you need to run a privileged command, you can now simply use sudo right from your current terminal session. This can save time and provide a smoother workflow.

For example, to run the netstat command with admin rights, instead of opening a new elevated Command Prompt, you can just run:

sudo netstat -ab

You will be prompted to verify the elevation, and the command will run with administrator access within your current terminal.

How to Enable Sudo in Windows

To use Sudo for Windows, you must be on Windows 11 Insider Preview Build 26052 or newer. You can then enable it by going to Settings > System > For Developers and turning on the "Enable sudo" option.

Enable Sudo in Windows

Sudo for Windows can be used as a potential escalation of privilege vector when enabled in certain configurations. You should make sure to be aware of the security considerations when enabling the sudo command on your system.

Three Configuration Options

Sudo for Windows offers three different configuration modes you can choose from:

  1. In a new window (forceNewWindow) - This is the default mode that runs the elevated command in a new window, similar to runas.
  2. Input closed (disableInput) - Runs the elevated process inline but with input disabled to the process for security.
  3. Inline (normal) - Runs the elevated process inline with input allowed, most closely matching traditional sudo behaviour.

The inline modes provide convenience but have higher security considerations compared to the isolated new window mode.

Open Source and Contributing

Microsoft has now open sourced the Sudo for Windows code on GitHub to allow community contributions and feedback. You can check the GitHub Repo.

They have also open sourced a sudo.ps1 PowerShell script that aims to provide a more user-friendly sudo experience in PowerShell.

While sudo is a new addition to the Windows world, it has the potential to boost productivity for developers, IT pros and power users by allowing quick elevation of commands without context switching.

With Microsoft now open sourcing the project, the community can help shape and improve the sudo experience on Windows.

Post a Comment