New Desert Penguin Blog

Sudo for Windows?

07 June 2024 12:42

MSFT claim to have introduced a "sudo" command for Windows:

https://devblogs.microsoft.com/commandline/introducing-sudo-for-windows/


I am obviously not smart enough to understand this.

I am trying sudo and all I am getting is a program launched with exactly the same group memberships and privileges I already have. I am also unable to find any way to configure which programs should be startable by sudo.


I noticed that when UAC is enabled and I am in the Administrators group and running a non-elevated shell, sudo appears to be doing the same as Start-Process -Verb RunAs.

(Or in Win32 terminology, basically ShellExecuteW(NULL, L"RunAs", L"C:WindowsSystem32cmd.exe", NULL, NULL, SW_NORMAL);)


Is that it? What am I missing?

How is that "sudo" in any meaningful sense? And if it isn't supposed to be, why use the name of a command that very obviously does something completely different, namely do something as superuser?


Does Windows even need a "sudo" command? It wouldn't, if it weren't for the Administrators group that made it so easy for everyone to "solve" permissions issues by running as administrator all the time. Technically every action that need to be performed in Windows should run in a security context that grants it the permissions it needs. There is no reason why anything should run as a "superuser" to do something specific. Need to change a setting as superuser? Permission the setting to be changed by whomever is supposed to be to change it.

But since "sudo" for Windows apparently does nothing, the problem remains ignored. :(