![dnf install 权限不一致](https://linux22.com/image/1511582/dnf%20install%20%E6%9D%83%E9%99%90%E4%B8%8D%E4%B8%80%E8%87%B4.png)
我为什么会不是当root
shell “猜测” 包时我需要执行一个命令吗?
例如:
(cseymour) : ~ $ dnf install rogue
Error: This command has to be run under the root user.
(cseymour) : ~ $ rogue
bash: rogue: command not found...
Install package 'rogue' to provide command 'rogue'? [N/y] y
* Waiting in queue...
The following packages have to be installed:
rogue-5.4.5-19.fc24.x86_64 The original graphical adventure game
Proceed with changes? [N/y] y
* Waiting in queue...
* Waiting for authentication...
* Waiting in queue...
* Downloading packages...
* Requesting data...
* Testing changes...
* Installing packages...
等等,成功安装软件包而不需要 root 密码。
答案1
有小包装PackageKit 命令未找到安装在 Fedora 中,这可以实现这一点。策略在 中配置/etc/PackageKit/CommandNotFound.conf
。
身份验证是通过PolicyKit(通过 D-bus),您已使用 PackageKit GUI 授予安装新软件包的权限。相应的文件允许为组usr/share/polkit-1/rules.d/org.freedesktop.packagekit.rules
中本地登录的用户安装软件包:wheel
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.packagekit.package-install" &&
subject.active == true && subject.local == true &&
subject.isInGroup("wheel")) {
return polkit.Result.YES;
}
});
如果您对此行为不满意,您可以随时卸载此包(dnf remove PackageKit-command-not-found
),并且该包将不会自动安装。