Microsoft Confirms Bringing Sudo For Windows, Is Open-Source Too
As with the behavior on Linux and other platforms, Sudo for Windows is used to run elevated commands directly from an unelevated console session. With the latest Windows 11 Insider Preview builds, the "Sudo for Windows" can be enabled via Windows Setting with an "Enable Sudo" option. Or from an elevated console session it can be initially enabled via "sudo config --enable".
Once enabled, sudo on Windows behaviors similar to Linux and other platforms.
The Sudo for Windows announcement appeared in my RSS feed for the Microsoft Command Line blog but since then it's been 404'ing. So the announcement may be delayed it seems given that it's no longer loading. They say they will be further improving Sudo for Windows over the coming months.
The post noted that Sudo for Windows will be open-source via microsoft/sudo on GitHub but again as of writing it's currently not appearing.
It's pretty wild seeing Microsoft embrace sudo on Windows but not too surprising after SSH for Windows, native support for GZ, and other Linux-like features being supported by Windows 11 over time -- not to mention WSL.