在 debian/sid 中​​以普通用户身份挂载 USB 驱动器

在 debian/sid 中​​以普通用户身份挂载 USB 驱动器

我正在使用 debian sid,由于升级之一,我无法正常安装 USB 驱动器(sdcard)。

在 dolphin 中,它会显示消息“未授权执行操作” 海豚错误

所以经过一番阅读后,似乎在后台它正在做

udisksctl mount -b /dev/sdj1

这一个以“==== AUTHENTICATING FOR org.freedesktop.udisks2.filesystem-mount ===”结尾,并要求输入 root 密码。

经过一番阅读后,我发现这可能是策略套件所以我添加了 /etc/polkit-1/localauthority/50-local.d/emil-can-mount-usb.pkla

[mounting without password]
Identity=unix-user:emil
Action=org.freedesktop.udisks2.filesystem-mount
ResultAny=no
ResultInactive=no
ResultActive=yes

添加后没有任何改变。 Dolphin 无法挂载,CLI 要求输入密码。所以我尝试通过停止 polkit 服务来调试它并手动启动它

/usr/libexec/polkitd > /tmp/polkitd.log 2>&1

然后在日志中我可以看到以下内容

** (polkitd:27925): DEBUG: 17:39:58.602: system-bus-name::1.37 is inquiring whether system-bus-name::1.1748 is authorized for org.freedesktop.udisks2.filesystem-mount
** (polkitd:27925): DEBUG: 17:39:58.603:  user of caller is unix-user:root
** (polkitd:27925): DEBUG: 17:39:58.603:  user of subject is unix-user:emil
** (polkitd:27925): DEBUG: 17:39:58.603: checking whether system-bus-name::1.1748 is authorized for org.freedesktop.udisks2.filesystem-mount
** (polkitd:27925): DEBUG: 17:39:58.603:   0x7f97ac00c4a0
** (polkitd:27925): DEBUG: 17:39:58.604: Checking whether session 1 is active.
** (polkitd:27925): DEBUG: 17:39:58.604: Session 1 has UID 1000.
** (polkitd:27925): DEBUG: 17:39:58.604: UID 1000 has state online.
** (polkitd:27925): DEBUG: 17:39:58.604:  subject is in session 1 (local=1 active=0)
** (polkitd:27925): DEBUG: 17:39:58.604:  challenge (implicit_authorization = auth_admin)
** (polkitd:27925): DEBUG: 17:39:58.604:  
** (polkitd:27925): DEBUG: 17:39:58.609: Added authentication agent for unix-process:31011:409192549 at name :1.1748 [udisksctl mount -b /dev/sdj1], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale pl_PL.UTF-8
** (polkitd:27925): DEBUG: 17:39:58.611: system-bus-name::1.37 is inquiring whether system-bus-name::1.1748 is authorized for org.freedesktop.udisks2.filesystem-mount
** (polkitd:27925): DEBUG: 17:39:58.611:  user of caller is unix-user:root
** (polkitd:27925): DEBUG: 17:39:58.612:  user of subject is unix-user:emil
** (polkitd:27925): DEBUG: 17:39:58.612: checking whether system-bus-name::1.1748 is authorized for org.freedesktop.udisks2.filesystem-mount
** (polkitd:27925): DEBUG: 17:39:58.613:   0x7f97ac00a530
** (polkitd:27925): DEBUG: 17:39:58.613: Checking whether session 1 is active.
** (polkitd:27925): DEBUG: 17:39:58.613: Session 1 has UID 1000.
** (polkitd:27925): DEBUG: 17:39:58.613: UID 1000 has state online.
** (polkitd:27925): DEBUG: 17:39:58.613:  subject is in session 1 (local=1 active=0)
** (polkitd:27925): DEBUG: 17:39:58.614:  challenge (implicit_authorization = auth_admin)
** (polkitd:27925): DEBUG: 17:39:58.614:  
** (polkitd:27925): DEBUG: 17:39:58.614:  using authentication agent for challenge
(polkitd:27925): GLib-DEBUG: 17:39:58.614: setenv()/putenv() are not thread-safe and should not be used after threads are created
(polkitd:27925): GLib-DEBUG: 17:39:58.614: setenv()/putenv() are not thread-safe and should not be used after threads are created

1000是我的用户“emil”的UID,但这是什么意思“system-bus-name::1.37正在询问system-bus-name::1.1748是否被授权用于org.freedesktop.udisks2.filesystem-mount”为什么它不是检查用户,而是检查进程ID

总之,我的问题是:我该如何解决这个问题(不需要密码,文件管理器只是打开它)。

相关内容