有时候,sudoers
并不是控制Ubuntu和其他Linux发行版上用户权限的唯一方法,Polkit允许对权限进行更细粒度的控制,
/etc/polkit-1/localauthority.conf.d/
假设是99-custom.conf
),包含:
[Configuration]
AdminIdentities=unix-user:Y
$ pkexec bash -l
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/bin/bash' as the super user
Authenticating as: muru,,, (muru)
Password:
==== AUTHENTICATION COMPLETE ===
由于你是管理员用户,pkexec
将提供以下选项:
$ pkexec bash
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/bin/bash' as the super user
Multiple identities can be used for authentication:
1. X,,, (Y)
2. Y,,, (X)
Choose identity to authenticate as (1-2):
相关文章