Microsoft continues to Linux! sudo native command strong login to Windows!

Mondo Technology Updated on 2024-02-26

Recently, there was news that the sudo command is coming to Windows.

Sudo (Superuser Execution) has long been a powerful management tool in UNIX-like operating systems. Its core function is to allow a normal user to run the program with superuser privileges (usually administrator privileges) in some commands.

While Windows has long provided the option to "run as administrator", Sudo provides a more granular way to manage privileges than starting an elevated privilege console session. Users can choose to elevate privileges only for a single command.

For users who are familiar with the Sudo feature in Linux and macOS, this update is undoubtedly worth looking forward to.

This move also reaffirms Microsoft's growing acceptance and integration of Linux elements in operating system development. Microsoft has completely reinvented itself as a "cancer" in the past, and the trend towards Linux features continues to increase in order to continue to promote cross-platform compatibility and improve the user experience.

Microsoft intends to release the project as an open-source project on GitHub. Users can enable this feature through the Windows settings page or the command line.

Soon after, if you're running the Windows 11 operating system, you'll be able to type a command like this into Windows Terminal:

Of course, this is a classic command in Linux. When you run sudo[command], the familiar Windows User Account Control (UAC) pop-up will appear, asking if you want to elevate privileges. If you select Confirm, the next command statement will be executed as an administrator.

In the above example, if a user (non-administrator) opens a Windows terminal in a regular way, it is generally not possible to use the sudo command here. However, all of this changed in the latest Windows 11 internal preview build (build 26052), which included Sudo as an optional developer feature.

Assuming you're part of the Windows Insider program, you can enable the Sudo feature through the Windows Settings > Developer Options page. Alternatively, you can start an elevated Windows Terminal session and use the following command to activate sudo:

The option sudo gives you full access just like you would on Linux. Alternatively, you can choose a more secure option, such as sudo disableinput, which does not allow the elevated privilege process to receive any further user input; Or use sudo forcenewwindow, which runs the newly elevated privilege process in a new terminal window.

Both of these approaches are able to mitigate some potential security vulnerabilities, but they change the way Sudo works so that it is not exactly the same as the implementation in Linux.

Microsoft has hinted at the possibility of backporting the Sudo feature to Windows 10. As a result, this new feature is expected to become a standard option even for developers on older PCs. As a result, in the future, whether it's Windows 10 or Windows 11, developers may be able to enjoy a Linux-like Sudo rights management experience in the Windows operating system.

Of course, some people will also question, does this update really make sense?

Without sudo, Windows users can use some form of the runas command to gain administrator privileges - either by typing in the command line or by right-clicking on the Windows Terminal icon in the Start menu and selecting "Run as Administrator".

So technically, Sudo doesn't offer new features that weren't possible before. It just allows you to do it the traditional Linux way. However, this is especially handy for true Linux users, whether you spend a lot of time configuring a server or cloud environment, or prefer to develop on that operating system. Using sudo is like typing ls instead of dir in Linux, or typing cat instead of type, so you can use the commands you are most familiar with without additional cognitive switching.

Another less obvious but equally important aspect is that adding features like Sudo helps Windows developers become more familiar with Linux conventions. In the past, developers have also mentioned a growing preference for using Linux commands over Windows-only native shell commands. Because the more familiar you are with Linux commands, the less likely you are to feel lost and isolated the next time you actually work at a Linux prompt, such as in a cloud environment like AWS.

If you're new to Microsoft's embrace of Linux, you should definitely check out WSL (Windows Subsystem for Linux), a Linux kernel that was shipped with Windows and supports a variety of interesting interoperability scenarios. For example, you can develop directly in a virtual Linux file system using VS Code and run Linux containers in Docker. "Every Windows developer needs a little bit of Linux" is not a simple joke.

After more than two decades, Microsoft's internal hostility to Linux has been completely abandoned. It's clear that without this shift, Microsoft might just be a footnote in the history of technology. And in the current timeline, Microsoft's embrace of Linux has become more and more thorough, such as building the world's most popular ** editor (VS code) with j**ascript, which will be huge. The .NET project was refactored to be cross-platform and open source, and of course - quietly embedding the full Linux kernel into the core of Windows.

Related Pages