Microsoft Introduces Sudo for Windows 11 Version 24H2, Enhancing Security

Apps & Games / Desktop / Windows / Microsoft Introduces Sudo for Windows 11 Version 24H2, Enhancing Security
25 Jul 2024

Windows users can now enjoy a feature long cherished by Linux aficionados: the sudo command. This powerful tool allows users to execute programs with the security rights of another user—typically the superuser or administrator—without needing to log in with full administrative privileges. This is particularly beneficial for tasks that require elevated permissions, offering a more secure and convenient way to manage administrative duties.

Sudo Complements RunAs

Microsoft has acknowledged the advantages of sudo and is introducing it to Windows 11 systems with the Windows 11 version 24H2 update. Although it's uncertain whether Windows Server 2022/2025 will also receive sudo, the source code for Sudo for Windows is already available on GitHub.

While Windows already has the RunAs command, which allows users to start a command in the command line using another user account, RunAs is often seen as cumbersome and less effective compared to sudo. The RunAs command requires you to enter the password of the specified user, and it runs applications entirely in the context of that user. In contrast, sudo offers more nuanced control over permissions and logging, making it a more flexible and comprehensive tool for system administration.

For example, RunAs is used in the format runas /user program, where you must enter the password of the specified user. However, sudo provides similar functionality but with differences in application and administration. Currently, sudo doesn't allow you to start a program as if you were someone else; it lets you execute commands as a superuser or administrator. Microsoft plans to add this functionality in future updates.

While RunAs allows temporary elevation of permissions for a specific program or script, sudo supports the delegation of specific commands without granting full administrator rights, offering finer control over system administration. Despite its potential, Microsoft has so far implemented only a few of the functions available in the original sudo command for Linux, so Sudo for Windows currently has limited capabilities compared to its Linux counterpart.

Enabling Sudo in Windows 11 Version 24H2

Sudo isn't enabled by default on all systems, though this may change in future updates. Starting with Windows version 24H2, Sudo for Windows comes pre-installed but requires manual activation. When you enter the sudo command in the command line, terminal, or PowerShell, Windows 11 version 24H2 will prompt you to activate it first.

To enable sudo, navigate to System > For developers in the Windows 11 settings and select Enable Sudo. Before final activation, you'll need to confirm via a User Account Control message. Alternatively, you can activate Sudo for Windows using the sudo command itself, with various options available:

  • In a new window (forceNewWindow)
  • In the same window (normal)
  • Disable input (disableInput)

This new feature brings a significant enhancement to Windows' administrative capabilities, providing users with more secure and efficient ways to manage their systems.

Update: 25 Jul 2024