Linux command
pkexec 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Example
pkexec [command]
Example
pkexec
Example
pkexec --user [username] [command]
说明
pkexec executes programs as another user with privilege escalation via PolicyKit. Unlike sudo, it integrates with the desktop environment and can show graphical authentication dialogs when available. Authorization decisions are based on PolicyKit policies, allowing fine-grained control over which users can run which programs with elevated privileges. Actions can be configured to require authentication or be allowed without it.
参数
- --user _username_
- Run as specified user instead of root
- --disable-internal-agent
- Don't use built-in authentication agent
- --keep-cwd
- Keep current working directory
FAQ
What is the pkexec command used for?
pkexec executes programs as another user with privilege escalation via PolicyKit. Unlike sudo, it integrates with the desktop environment and can show graphical authentication dialogs when available. Authorization decisions are based on PolicyKit policies, allowing fine-grained control over which users can run which programs with elevated privileges. Actions can be configured to require authentication or be allowed without it.
How do I run a basic pkexec example?
Run `pkexec [command]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --user _username_ do in pkexec?
Run as specified user instead of root