ACL SETUSER to create a new ACL user or change the rules of an existing one.
Rules are applied left to right in a single call: they enable or disable the user (on, off), grant or revoke access to key patterns (~pattern), channel patterns (&pattern), commands and categories (+get, -@admin), and manage passwords. Because rules are cumulative, calling SETUSER again only adds to or removes from what a user already has; use reset to start over from a clean slate.
Syntax
Arguments
Important points
- This command can expose administrative information or make a broad destructive change. Restrict it to trusted code paths.
nopassis rejected. Every user must have at least one password; there is no way to allow authentication with any password.- Plain-text passwords (
>password) and pre-hashed passwords (#hash) are rejected. Passwords must be generated withACL GENTOKENand added with>token; this is what lets the same credential authenticate on both the TCP and REST endpoints. - Subcommand-scoped rules such as
+client|listare not supported and return an error. - The
defaultuser cannot be modified; the command returns an error if it is the target. - Changes take effect immediately on new and existing connections, so a rule that narrows access can lock out a running application. Check with
ACL GETUSERbefore applying it broadly.
Response
The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.
Examples
TCP examples use the TLSREDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.
Redis CLI
Redis CLI
@upstash/redis
@upstash/redis
This command is not supported yet in
@upstash/redis.upstash_redis
upstash_redis
This command is not supported yet in
upstash_redis.ioredis
ioredis
node-redis
node-redis
redis-py
redis-py
go-redis
go-redis
jedis
jedis
redis-rs
redis-rs