Skip to main content

Shell Grants

A shell grant lets an API token, typically an assistant connected through MCP, run commands on one host for a limited time after a person has approved it once. It replaces raw SSH for that case: the access has an approval, an end, a record and an audit trail.

Requesting​

The client calls request_shell with the host, a reason and the duration it wants. The default is 30 minutes and the longest is 240. A token has at most one pending or active grant per host.

Approving​

Approval is always required, whatever the customer's policy says for people.

  • Without the customer's Require approval policy, the account the token belongs to decides, and only that account is notified, in the bell, in the approval dialog if the dashboard is open, and by mail if it is not.
  • Under Require approval, another account that may decide access at that customer decides; the token's account may not.

The approver chooses the duration, up to what was asked. A request nobody decides lapses after an hour.

While it is active​

The token's commands on that host run as script.run jobs without a separate approval. The usual rules still apply: the account needs access.shell at the customer and the right to run scripts, and the host must be an approved agent host that allows script.run. Each command starts in the directory the previous one ended in.

Commands are refused when the grant has ended, has run out, was revoked, or belongs to another token or host.

The record​

Open /shell-grants/<id> to see who asked, why, who approved, the validity window, the remaining time and every command with its output, exit code and duration. The page updates while the grant runs. The audit log has shell_grant.request, .approve, .deny, .command, .end, .revoke and .expire, naming the token and the account, for example "Claude (Jane Admin)".

Ending it​

  • It ends by itself when the time is up.
  • The token's account or an administrator revokes it on its page, or the client calls end_shell.
  • Revoking the API token or losing access.shell ends it.

Commands already running finish; new ones are refused.

Upgrading​

Needs the database migration 0519_shell_grants, which runs on start.