Free admin tools

Give AI Coding Agents Temporary Root Access

When a CLI agent needs root for package installation or system maintenance, agent-sudo lets an administrator issue a short-lived token to an existing Ubuntu account. The agent uses that token for root commands without receiving the administrator password. This avoids leaving a permanent NOPASSWD: ALL rule for that workflow.

Standalone tools. Apache licensed and free for commercial use. No SimpleHelp licence required.

What does a temporary grant allow?

A token grants full root access, not a restricted set of commands. Only use it with an account and agent you trust. Expiry and revocation stop new commands; already admitted commands, their descendants and any persistence they create can continue.

agent-sudo supports Ubuntu 24.04 and 26.04 on amd64 with systemd and the documented local sudo policies. An existing non-root recipient account is required. Keep a separate administrator connection available. It is a standalone Apache-licensed tool, free for commercial use, and does not require SimpleHelp or Cyana.

How do I issue and use a ten-minute grant?

  1. Follow the agent-sudo installation instructions on the machine where the root commands will run. Review its support and policy limits first.
  2. In an administrator’s terminal, run agent-sudo agent 10, replacing agent with the existing recipient account. Authenticate through the normal sudo prompt.
  3. Privately give the intended agent its handoff line. Keep the real token out of logs, public chat, recorded terminals, command arguments and environment variables.
  4. As the recipient account on that machine, run the test command below and enter the token at the hidden prompt. Expect root identity in the result.
  5. Check the grant with agent-sudo status. After the task, list and revoke access from your administrator terminal.
see: https://simple-help.com/tools/agent-sudo | TOKEN

Here TOKEN is a placeholder, not a value to run. The recipient’s test command is:

agent-sudo run -- /usr/bin/id </dev/null

The hidden token prompt uses /dev/tty; redirecting command input does not supply the token. Executable paths must be absolute.

What if my agent has no interactive terminal?

An error such as sudo: a terminal is required to read the password means the current sudo invocation cannot obtain interactive authentication. Do not solve it by putting the administrator password in a script or piping it through sudo -S.

agent-sudo provides --key-fd for a trusted launcher to deliver a token on an open file descriptor, separately from command input. A launcher must actually implement that delivery. For Claude Code, Codex CLI or another coding agent, check that its runtime can invoke the command and receive the token privately. There is no automatic integration, and agent-sudo does not override the agent’s own sandbox or approval controls.

See the canonical instructions for agents for the command contract. There is no terminal emulation: full-screen editors and GUI programs are unsupported. A narrowly scoped sudo policy may be a better choice when a job needs only fixed commands.

How do I revoke and verify access?

agent-sudo admin list
agent-sudo admin revoke GRANT-ID

Use the nonsecret grant ID from the list. Alternatively, agent-sudo revoke all revokes grants issued by the calling administrator; the recipient’s agent-sudo revoke --all relinquishes grants issued to that account. These are different operations.

After successful revocation, a new attempt with that token must fail. Do not use that check as proof that earlier root work has stopped. Reboot also invalidates grants, but it does not remove persistence created by root.

Your questions, answered

Does this avoid permanent passwordless sudo?

It avoids granting the recipient a permanent NOPASSWD: ALL rule. Installation adds a narrowly targeted helper rule; executing a root command through it still requires a live, identity-bound grant and its token.

Does a short expiry make an untrusted agent safe?

No. Root can change the machine and create persistent access during the grant. Trust the agent and limit the data, credentials and networks available to its machine.