3

微软正式开源专为Windows打造的Sudo

 1 month ago
source link: https://www.techug.com/post/microsoft-officially-opens-up-sudo-specifically-designed-for-windows-d0c11d/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

微软正式开源专为Windows打造的Sudo

微软已在 Windows 11 Insider Preview Build 26052 中发布适用于 Windows 的 Sudo,并将其在 MIT 协议下进行开源。

Sudo for Windows 将允许用户直接从未提权终端窗口运行提权命令。

如何启用 Sudo for Windows

导航至 Settings > For Developers page in Windows Settings and toggle on the “Enable Sudo” 选项:

也可以通过运行以下命令:





sudo config --enable <configuration_option>



如何配置 Sudo for Windows

目前支持三种不同的配置选项:

  1. 开启新窗口 (forceNewWindow)

  2. 禁用输入 (disableInput)

  3. 内联 (normal)

要更改配置选项,可使用 Settings > For Developers page in Windows Settings 页面中的下拉菜单:

或运行以下命令:

sudo config --enable <configuration_option>
配置选项 1:开启新窗口

在此配置中,Sudo for Windows 将打开一个新的窗口并运行命令。这是启用 sudo 时的默认配置选项。例如,如果运行:

sudo netstat -ab



配置选项 2:禁用输入

在此配置中,Sudo for Windows 将在当前窗口中运行提权后的进程,但新进程生成时将关闭其 stdin。这意味着新进程将不接受任何用户输入,因此此配置不适用于提权后需要用户进一步输入的进程。

配置选项 3:内联

此配置与其他操作系统上 sudo 的行为最相似。在此配置中,Sudo for Windows 将运行提权的进程,其 stdin、stdout 和 stderr 均连接到当前窗口。这意味着新的提权进程可以接收输入并 route output 到当前窗口。

微软方面表示,团队将在接下来几个月中致力于扩展 Sudo for Windows 的文档,并将分享更多有关在 “内联” 配置中运行 sudo 的安全影响的细节。同时致力于 Sudo for Windows 的开源工作,分享更多相关细节。

详情查看官方博客:

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

https://github.com/microsoft/sudo

本文文字及图片出自 OSC开源社区

O1CN011OQdmCD55GV3suq_!!2768491700.jpg_640x640q80_.webp

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK