- Home
- Skills
- DevOps & Cloud
- Run as Root - safe one-command sudo for AI agents
Works with the AI Agents you already use
Run as Root - safe one-command sudo for AI agents
Your agent runs one command as root through the Linux desktop's own polkit dialog — you approve the exact command, and it never sees your password.
Free
Run as Root - safe one-command sudo for AI agents
Example session with this skill installed
I'm setting up this project but the build just failed with "Permission denied" when it tried to install build-essential. Can you install the build tools for me?
- Read your context and instructions
- Compiled the run as root
I need root to install those packages, so I'll use the
run-as-root skill — you'll approve the exact command in your desktop's password dialog, and I never see your password.
First I confirmed you're at a local graphical session (this skill refuses to run otherwise):
Type=x11 Active=yes Remote=no ✓
A password dialog is about to open. Here is exactly what it will show:
Root command: /usr/local/bin/run-as-root
Why: Install the build tools
Command: /usr/bin/apt-get install -y build-essential
[ Cancel ] [ Authenticate ]
The command I ran
timeout 180 pkexec /usr/local/bin/run-as-root \
$'\nWhy: Install the build tools\nCommand:' \
/usr/bin/apt-get install -y build-essential
Result: you authenticated, exit code 0.
Reading package lists... Done
Building dependency tree... Done
The following NEW packages will be installed:
build-essential dpkg-dev g++ gcc make ...
Setting up build-essential (12.9ubuntu3) ...
✅ Build tools installed. The run was recorded to the audit trail — review it anytime with journalctl -t run-as-root. Re-running your build now.
Connects securely to your tools. The creator never sees your data.
About this skill
The problem
Coding agents constantly hit commands that need root — apt install, systemctl, writing to /etc. The usual answers are all bad:
- Give the agent your password (
sudo -S, an askpass script) — the agent now holds your password. - Passwordless sudo (
NOPASSWD) — the agent has permanent, invisible root. - Stop and make you run it — breaks your flow, and you paste commands without reading them.
What it does
run-as-root gives the agent a fourth option: escalate one command at a time through your desktop's own polkit password dialog.
- The dialog shows the agent's stated reason and the true command line.
- You type your password into the operating system's prompt — never into the agent.
- The password travels polkit's own path (authentication agent →
polkit-agent-helper-1→polkitd). No part of the agent's code touches it. - Every run is written to the
authprivaudit log with the full command.
Why this beats the alternatives
| Method | Problem | run-as-root |
|---|---|---|
| Password to the agent | Agent holds your secret | Agent never sees it |
| NOPASSWD sudo | Permanent, invisible root | One command, one dialog, logged |
| Hand it back to you | Breaks flow; blind paste | You approve the exact command inline |
Use cases
- Let an agent install build dependencies, drivers, or packages mid-task.
- Approve
systemctl,mount,usermod, or writes to/etc,/usr,/opt. - Keep a full, reviewable audit trail of everything an agent ran as root.
Known limitations
- Linux desktop only (X11 or Wayland) with a running polkit agent.
- Tested on Linux Mint 22.3 / Cinnamon / polkit 124; other desktops and distros use standard polkit and should work, but are untested.
- Not for headless servers, SSH, containers, CI, cron, WSL, macOS or Windows — the skill detects these and hands the command back instead.
- You must already be an administrator (
sudo/admin/wheel). It grants no new privilege — the same power assudo, and not more.
How to install
- Add the skill:
npx skills add govarthenan/run-as-root - Install the system helper yourself, in your own terminal:
sudo bash ~/.claude/skills/run-as-root/install.sh - Remove anytime:
sudo bash ~/.claude/skills/run-as-root/uninstall.sh
MIT licensed. Author: Govarthenan Rajadurai.
Linux desktop only. No support for headless servers, SSH, CI, or containers. Requires a local user at the screen to answer the polkit dialog.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
1 use
Times used to date
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 1 month ago
- Free with an Agensi account
Requires