2020-04-07 18:55:19 +00:00
|
|
|
---
|
2020-09-01 15:14:13 +00:00
|
|
|
layout: commands
|
2020-04-07 18:55:19 +00:00
|
|
|
page_title: 'Commands: ACL Set Agent Token'
|
|
|
|
---
|
|
|
|
|
|
|
|
# Consul ACL Set Agent Token
|
|
|
|
|
|
|
|
Command: `consul acl set-agent-token`
|
|
|
|
|
|
|
|
This command updates the ACL tokens currently in use by the agent. It can be used to introduce
|
|
|
|
ACL tokens to the agent for the first time, or to update tokens that were initially loaded from
|
2021-05-31 23:05:47 +00:00
|
|
|
the agent's configuration. Tokens are not persisted unless
|
|
|
|
[`acl.enable_token_persistence`](/docs/agent/options#acl_enable_token_persistence)
|
|
|
|
is `true`, so tokens will need to be updated again if that option is `false` and
|
|
|
|
the agent is restarted.
|
2020-04-07 18:55:19 +00:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2020-04-07 23:56:08 +00:00
|
|
|
Usage: `consul acl set-agent-token [options] TYPE TOKEN`
|
2020-04-07 18:55:19 +00:00
|
|
|
|
|
|
|
### Token Types
|
|
|
|
|
|
|
|
- `default` - The default token is the token that the agent will use for
|
|
|
|
both internal agent operations and operations initiated by the HTTP
|
|
|
|
and DNS interfaces when no specific token is provided. If not set the
|
|
|
|
agent will use the anonymous token.
|
|
|
|
|
|
|
|
- `agent` - The token that the agent will use for internal agent operations.
|
|
|
|
If not given then the default token is used for these operations.
|
|
|
|
|
2021-12-02 17:05:27 +00:00
|
|
|
- `recovery` - This sets the token that can be used to access the Agent APIs
|
|
|
|
in the event that the ACL datacenter cannot be reached. In Consul versions
|
|
|
|
prior to 1.11, this token type was called `master`.
|
2020-04-07 18:55:19 +00:00
|
|
|
|
|
|
|
- `replication` - This is the token that the agent will use for replication
|
|
|
|
operations. This token will need to be configured with read access to
|
|
|
|
whatever data is being replicated.
|
|
|
|
|
|
|
|
### API Options
|
|
|
|
|
|
|
|
@include 'http_api_options_client.mdx'
|
2020-04-07 23:56:08 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
@include 'http_api_options_server.mdx'
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
Set the `default` token:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2020-04-07 18:55:19 +00:00
|
|
|
$ consul acl set-agent-token default c4d0f8df-3aba-4ab6-a7a0-35b760dc29a1
|
|
|
|
```
|