首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >polkit规则未被识别的raspbian拉伸

polkit规则未被识别的raspbian拉伸
EN

Unix & Linux用户
提问于 2017-11-30 11:48:51
回答 2查看 1.3K关注 0票数 1

我正在运行一个raspbian扩展,我希望授予组用户的每个成员安装和卸载usb挂载的权利。

因此我安装了:udisks2

我创建了一个具有以下内容的*.rules文件/usr/share/polkit-1/rules.d/50-udisks.rules

代码语言:javascript
复制
polkit.addRule(function(action, subject) {


var YES = polkit.Result.YES;
  var permission = {
    // only required for udisks1:
    "org.freedesktop.udisks.filesystem-mount": YES,
    "org.freedesktop.udisks.filesystem-mount-system-internal": YES,
    "org.freedesktop.udisks.luks-unlock": YES,
    "org.freedesktop.udisks.drive-eject": YES,
    "org.freedesktop.udisks.drive-detach": YES,
    // only required for udisks2:
    "org.freedesktop.udisks2.filesystem-mount": YES,
    "org.freedesktop.udisks2.filesystem-mount-system": YES,
    "org.freedesktop.udisks2.encrypted-unlock": YES,
    "org.freedesktop.udisks2.eject-media": YES,
    "org.freedesktop.udisks2.power-off-drive": YES,
    // required for udisks2 if using udiskie from another seat (e.g. systemd):
    "org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
    "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
    "org.freedesktop.udisks2.eject-media-other-seat": YES,
    "org.freedesktop.udisks2.power-off-drive-other-seat": YES
  };
  if (subject.isInGroup("users")) {
    return permission[action.id];
  }
});

我重新启动了polkit服务:

代码语言:javascript
复制
systemctl restart polkit

当发布:udiskctl mount -b /dev/sda1时,用户仍然被要求以root用户身份登录。

知道出什么问题了吗?

EN

回答 2

Unix & Linux用户

发布于 2017-11-30 14:06:20

这似乎是因为Debian还没有使用JavaScript样式的规则文件。您必须将这样的*.pkla文件放在/etc/polkit-1/localauthority/50-local.d/53-udisk.pkla中。

名为“user”的单个用户的内容:

/etc/polkit-1/localauthority/50-local.d/53-udisk.pkla

代码语言:javascript
复制
[Enable Controlling of udisk]
Identity=unix-user:user
Action=org.freedesktop.udisks.filesystem-mount;org.freedesktop.udisks.filesystem-mount-system-internal;org.freedesktop.udisks.luks-unlock;org.freedesktop.udisks.drive-eject;org.freedesktop.udisks.drive-detach;org.freedesktop.udisks2.filesystem-mount;org.freedesktop.udisks2.filesystem-mount-system;org.freedesktop.udisks2.encrypted-unlock;org.freedesktop.udisks2.eject-media;org.freedesktop.udisks2.power-off-drive;org.freedesktop.udisks2.filesystem-mount-other-seat;org.freedesktop.udisks2.encrypted-unlock-other-seat;org.freedesktop.udisks2.eject-media-other-seat;org.freedesktop.udisks2.power-off-drive-other-seat
ResultAny=yes
ResultInactive=yes
ResultActive=yes

这样,它现在正在为我工作在拉斯潘伸展或杰西!

票数 2
EN

Unix & Linux用户

发布于 2022-12-18 04:36:02

我可以使用以下设置向udisk应用权限。

/etc/polkit-1/localauthority/50-local.d/50-udisks.pkla

代码语言:javascript
复制
[udisks]
Identity=unix-group:users
Action=org.freedesktop.udisks*
ResultAny=yes
ResultInactive=no
ResultActive=yes

参考资料:https://mxlinux.org/wiki/system/mount-internal-partition-without-using-root-password/

票数 1
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/407967

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档