← Back to list

using-polkit-cli
by pe200012
⭐ 0🍴 0📅 Jan 19, 2026
SKILL.md
name: using-polkit-cli version: 1.0.0 description: Use when needing to run privileged commands (root) and sudo is unavailable or failing, or when explicitly interacting with PolicyKit (pkexec). author: pe200012 license: BSD-3-Clause tags: [linux, polkit, security, cli, sudo]
Using Polkit CLI (pkexec)
Overview
pkexec is the PolicyKit equivalent of sudo. It allows you to execute a command as another user (typically root). In some environments where sudo is restricted or misconfigured for non-interactive shells, pkexec may work as a drop-in replacement.
When to Use
- You need to run a command as root (or another user).
sudois unavailable, restricted, or failing.- You are on a system using PolicyKit (standard on most modern Linux distros).
The Core Pattern
Simply use pkexec followed by the command you want to run.
pkexec <command>
If the system is configured correctly, it will prompt for the necessary authentication or execute if passwordless access is permitted.
Example Scenario
User: "Install nginx, but sudo is failing."
Agent Response:
# Use pkexec as a sudo alternative
pkexec apt-get install -y nginx
Common Mistakes
- Using
pkttyagentunnecessary: Do not usepkttyagentunless specifically debugged or requested. It can confuse agentic environments.pkexecoften handles the TTY correctly on its own. - Thinking
sudois the only way:pkexecis a valid alternative.
Notes
- Unlike
sudo,pkexecdefaults torootbut can run as other users with--user <username>. - If a password is required, the system will prompt for it on the standard input.
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon