a new tool for experts and professionals

a new tool for experts and professionals

System administrators, power users and other experts can rejoice: Windows 11 will allow them to use the famous sudo command, well known to macOS and Linux users. Here’s what you need to know about this feature and how to use it.

For several years, Microsoft seems to want to bring good ideas from other operating systems, notably Linux, to Windows. After the introduction in 2020 of a package manager called Windows Package Manager, usable on the command line with winget, another famous function of Unix systems is making its entry into Microsoft’s OS: the sudo command. Essential for system administrators and Linux users, the command appears in the preview of build 26052 of Windows 11, accessible to members of the Windows Insiders program since February 7, 2024. Although it will probably not be used on a daily basis , the arrival of the sudo command is very good news for administrators, power users or Windows tinkerers, which will save time and comfort when using a terminal or command prompt .

Windows sudo: a command to perform actions with elevated privileges

In any operating system, whether Windows, macOS or Linux, the actions that a user can perform are limited by their “privileges”, which can be seen as their rights or level of authorization on the system. On a personal computer running Windows, the user account created during the first startup is often of the Administrator type and therefore gives, a priori, maximum privileges to its owner on their computer. However, to avoid unintentional actions that could compromise the proper functioning of the system, some tools run with reduced privileges by default. This is the case, for example, of the Windows command prompt, which can be launched in “normal” mode (with restricted rights) or executed “as administrator” (with maximum rights).

Launching a Command Prompt on Windows 11 via the Start Menu © CCM

To perform certain actions requiring elevated privileges in a Windows command prompt, until now it was necessary to systematically open a specific terminal or command prompt session as administrator, which was not very practical. use and could present safety risks and improper handling. The command sudowhich means superuser do, makes it possible to alleviate these constraints, by offering the possibility of executing an action requiring elevated privileges within a “classic” session of the terminal or command prompt. To do this, the command sudo Temporarily elevates the user’s rights to allow them to execute a single command, and only that one, before immediately lowering their rights to a lower level.

In the blog post dedicated to the presentation of sudo for Windowsan example of how it works is given with the launch of the command netstat -ab as administrator, within a session that has not been opened as administrator: to do this, the user simply has to write sudo netstat -ab. We see that the command is called from one PowerShell session and then executed in another high-privileged session which exits immediately after execution.

39489844
Using sudo to run a command as administrator ©Microsoft

How to enable and configure sudo command in Windows 11?

If you are keen to try the new command sudo for Windows, you will first need to activate and configure it. First, you must register for the Windows Insider program in order to get the preview version of build 26052 of Windows 11. Attention : Be aware that joining the Windows Insider program will result in the installation of potentially unstable versions of Windows. Consider backing up your important data to an external storage device and avoid activating the Insider program on a critical computer, such as your home office PC.

► On Windows, go to Settings > Windows Update > Windows Insider Program. If a red warning message appears at the top of this window, click Open Diagnostics and Feedback.

39489845

► In the window Diagnostics and commentsactivate the option Send optional diagnostic data then return to the previous window.

39489846

► Back on the window Windows Insider ProgramClick on the button Getting started on the right of Join the Windows Insider Program. A window titled Link an account to participate in the program opens, click while the button Link an account.

39489847

► In the next window, select your user account and click the button Continue. In the next step, titled Choose your Insider channelselect Canary Channel then click on the button Continuevalidate the last two steps by clicking on the button again Continue.

39489850

► Return to the screen Windows Update, start checking for updates, then download and install the preview build 26052 and restart your computer when prompted by Windows. Once the update is complete, go to Settings > System > Developer Centerlook for the option Enable sudo and activate it, and finally choose its operating mode from the drop-down list below.

39489851

It’s over, you can now take advantage of the brand new command sudo for Windows. To use it, all you have to do is open a terminal or command prompt (not as an administrator) and launch commands by simply preceding them with the word sudo !

ccn1