pkcheck
Check authorization status for PolicyKit actions
SYNOPSIS
pkcheck [--process pid] [--system-bus-name name] [--caller-pid pid] [--caller-system-bus-name name] [--action-id action_id] [--version] [--help]
PARAMETERS
--process PID
Specifies the process ID to use when checking authorization. If not specified, the current process ID is used.
--system-bus-name NAME
Specifies the system bus name to use when checking authorization. If not specified, the system bus name of the current process is used.
--caller-pid PID
Specifies the caller process ID. Only useful when called over dbus.
--caller-system-bus-name NAME
Specifies the caller system bus name. Only useful when called over dbus.
--action-id ACTION_ID
Specifies the action identifier to check for authorization.
--version
Displays the version of pkcheck.
--help
Displays help information.
DESCRIPTION
pkcheck is a command-line utility used to determine if a user is authorized to perform a specific action based on the configured Polkit (PolicyKit) policies. Polkit provides a mechanism for non-privileged processes to interact with privileged ones. pkcheck essentially queries the Polkit authority to see if the calling process (typically a user attempting an action) has the necessary privileges.
It's commonly used in shell scripts or other programs to pre-check authorization before attempting privileged operations, offering a way to gracefully handle situations where the user lacks sufficient permissions. The command outputs a success (exit code 0) if the user is authorized, and a failure (non-zero exit code) otherwise, often along with a textual explanation of the reason for failure.
CAVEATS
pkcheck relies on the proper configuration of Polkit. If Polkit is not correctly set up, or if the relevant authorization rules are missing or incorrect, pkcheck may not function as expected.
Also, the process running pkcheck must have the correct permissions to communicate with the Polkit daemon.
EXIT STATUS
The pkcheck command returns 0 if the user is authorized to perform the action; otherwise, it returns a non-zero value indicating an error or lack of authorization.
HISTORY
pkcheck is part of the Polkit framework, which was designed to provide a more flexible and secure alternative to traditional Unix suid programs. It has been integrated into most major Linux distributions and desktop environments over the years, becoming a key component for managing privileges and authorization. Its development is tied to the evolution of Polkit itself, aimed at providing finer-grained control over system resources and actions.