← 返回命令列表

Linux command

pkcheck 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Check authorization

pkcheck --action-id [org.freedesktop.action] --process [pid]

Check with user

pkcheck --action-id [action] --user [username]

Allow user interaction

pkcheck --action-id [action] --process [pid] --allow-user-interaction

说明

pkcheck queries the polkit daemon to determine whether a specific process, user, or D-Bus connection is authorized to perform a given action. It is the standard programmatic entry point for non-graphical authorization checks.

参数

-a, --action-id _ACTION_
The polkit action identifier to authorize against (e.g., _org.freedesktop.systemd1.manage-units_).
-p, --process _PID_,_START-TIME_,_UID_
Authorize the named process. Supplying _start-time_ and _uid_ closes a TOCTOU window where a PID can be reused.
-u, --user _USER_
Authorize as a specific user (only callable by root).
-s, --system-bus-name _NAME_
Authorize the D-Bus connection identified by _NAME_.
--allow-user-interaction
Permit polkit to prompt the user via the registered authentication agent.
--enable-internal-agent
Use a built-in text-mode agent when no graphical agent is registered (useful in TTY scripts).
--detail _KEY_ _VALUE_
Pass extra detail key/value pairs to the polkit policy (used by some action rules).
--help
Display help.

FAQ

What is the pkcheck command used for?

pkcheck queries the polkit daemon to determine whether a specific process, user, or D-Bus connection is authorized to perform a given action. It is the standard programmatic entry point for non-graphical authorization checks.

How do I run a basic pkcheck example?

Run `pkcheck --action-id [org.freedesktop.action] --process [pid]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a, --action-id _ACTION_ do in pkcheck?

The polkit action identifier to authorize against (e.g., _org.freedesktop.systemd1.manage-units_).