今日は、systemctlを使ってサービス終了/開始過程でパスワードを入力した後、5〜10分間の権限を要求しないように設定したかったです。そのため、ポリシー設定に入ると、すでにauth_admin_keepに設定されていることがわかります。
<action id="org.freedesktop.systemd1.manage-units">
<description gettext-domain="systemd">Manage system services or other units</description>
<message gettext-domain="systemd">Authentication is required to manage system services or other units.</message>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
Polkitが正常に動作していることを確認するために、pkexecのポリシー設定に移動し、次の新しい設定を指定しました。
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
奇妙なことに、パスワードを入力した後、pkexecは私の権限を覚えていましたが、systemctlは覚えていませんでした。
なぜこれが起こるのですか? systemctlに自分の権限を覚えさせるにはどうすればよいですか?
ベストアンサー1
Debian 11/Gnome 3.38でも同じ動作が発生します。keep
部分が常に機能するわけではありませんauth_admin_keep
。
すべての作業が同じだと思いますorg.gnome
(テストorg.gnome.controlcenter.datetime.policy
とorg.gnome.controlcenter.user-ccounts.policy
)。
注:Suseにはauth_admin_keep_session
ありますが、auth_admin_keep_always
Debianでは機能しません(https://documentation.suse.com/sles/15-SP2/html/SLES-all/cha-security-policykit.html)
Arch Linux
これはDebianや他のディストリビューション(Ubuntu?)にも関連しているので、投稿のタイトルから削除することをお勧めします。