pkexec
pkexec is a command-line utility that executes programs with elevated privileges, typically as the root user, under the control of the PolicyKit (polkit) authorization framework. It is part of the polkit package and serves as a modern alternative to tools like sudo or gksudo in many desktop environments. When invoked, pkexec consults polkit to determine whether the current user is allowed to run the requested program and, if authorized, launches the command with elevated privileges.
The authorization decision is governed by polkit policy files. The relevant action is usually org.freedesktop.policykit.exec, which
Environment handling and usage notes are important when using pkexec. By design, pkexec sanitizes the environment
Security considerations include ensuring correct polkit policies and avoiding reliance on PATH to locate executables. Use