如何从标准用户使用 sudo?

Tom*_*ený 3 sudo 12.04 user-management

如果我尝试以非特权用户身份使用 sudo,则会收到一条消息,指出该用户不在 sudoers 文件中。我知道管理员密码,但我不知道如何从非特权(标准)用户使用它。

mur*_*uru 5

pkexec代替使用。如果当前用户没有权限,或者有多个用户可以授权某个操作,则会提示您选择用户:

$ pkexec true              
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/bin/true' as the super user
Multiple identities can be used for authentication:
 1.  muru
 2.  sysad, (sysad)
Choose identity to authenticate as (1-2): 1
Password:
Run Code Online (Sandbox Code Playgroud)

pkexec当然,不是遵循sudo配置,而是它自己。但是,如果您通过将管理员用户添加到sudo组来添加管理员用户,则 Ubuntu 的默认配置也会向他们授予 Polkit 管理员权限。