---
title: "alpacon token acl command"
description: "Manage command ACL rules for a token. Use ls to inspect the token's command rules. See syntax, flag types, defaults, and examples for this Alpacon CLI command."
---

> Full documentation index: https://docs.alpacax.com/llms.txt

# alpacon token acl command

Manage command ACL rules for a token.

## Usage

```text
alpacon token acl command [flags]
alpacon token acl command [command]
```

## Key facts

- Use `ls` to inspect the token’s command rules.
- Use `add` or `delete` to change the rules.
- Without a matching rule, remote commands are denied.

## Flags

| Flag | Type | Description | Default |
| --- | --- | --- | --- |
| `-h, --help` | `bool` | help for command | `false` |
| `--output` | `string` | Output format: table or json | `table` |

## Examples

List command rules

```bash
alpacon token acl command ls my-api-token
```

Allow an exact command

```bash
alpacon token acl command add my-api-token --command="whoami"
```

Allow command arguments

```bash
alpacon token acl command add my-api-token --command="systemctl status *"
```

Include sudo in a privileged command rule

```bash
alpacon token acl command add my-api-token --command="sudo systemctl restart nginx"
```

If `add` or `delete` returns `command_acl_moved`, ask a Command ACL admin to manage the service token's pre-approved commands in the web console. On these servers, personal API tokens have no command list. `ls` remains available.

## Wildcard patterns

Use `*` as a wildcard to match any arguments:

| ACL rule | Matches | Does not match |
|----------|---------|----------------|
| `whoami` | `whoami` (exact) | `whoami --help` |
| `echo *` | `echo "hello"`, `echo foo bar` | `echo` (no arguments) |
| `systemctl status *` | `systemctl status nginx`, `systemctl status app` | `systemctl restart nginx` |
| `docker compose *` | `docker compose up -d`, `docker compose ps` | `docker run nginx` |
| `sudo systemctl restart nginx` | `sudo systemctl restart nginx` | `systemctl restart nginx`, `sudo -n systemctl restart nginx` |

A trailing ` *` requires at least one argument, so allow the bare form with a second rule. Any other `*` stays inside one word: `deploy-*` allows `deploy-web` but not `deploy-web --force`. A command line with a redirection (`>`, `<`, `2>&1`, and similar) is rejected whatever the rules say; see [How a command rule is matched](/use/iam/applications/service-tokens/command-patterns/#how-a-command-rule-is-matched).

Rules are matched against the command line you submit, not the command that runs as root, which means a rule for a privileged command must include the `sudo` prefix. Sudo policies use the opposite convention.

Never add a `sudo *` rule. Wildcards match across quoting, so it also allows `sudo bash -c "rm -rf /"`. See [Command patterns and sudo](/use/iam/applications/service-tokens/command-patterns/#why-wildcards-with-sudo-are-dangerous).

## Related commands

  
    Add a command ACL rule to a token
  
  
    List command ACL rules for a token
  
  
    Delete a command ACL rule by ID

Source: https://docs.alpacax.com/reference/cli/token/acl-command/
