---
title: "Users"
description: "Create cache users with a preset, keep their passwords in Secrets, rotate and delete them."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Users

Every connection to a cache uses a username and password. EZGH generates each user's password and
keeps it in a [Secret](/secrets) in the cache's project, ready for your app to read. You don't connect
to the cache to manage users, and changes apply without a restart.

A cache comes with the user `default`. On Valkey, it's also the user a client gets when it sends only a
password (`AUTH <password>`), so password-only clients work. `default` can't be deleted
(`409 default_user`), only rotated.

## Presets

On Valkey, a user has a preset:

| Preset | Can |
| --- | --- |
| `readWrite` | Read and write every key, use scripts (`EVAL`, `EVALSHA`, `FUNCTION`) and pub/sub, run `INFO`, and flush with `FLUSHDB` and `FLUSHALL`. The `default` user's preset. |
| `readOnly` | Run read commands on every key, and `INFO`. |

No user can run `CONFIG`, `ACL`, `MODULE`, `DEBUG`, `REPLICAOF`, `SHUTDOWN`, `SAVE`, `BGSAVE`,
`BGREWRITEAOF`, `MONITOR` or `CLUSTER`. A preset can change later.

On Memcached, every user can do everything, and there are no presets.

## Create a user

### Console

Open **Caches**, then the cache, then its **Users** tab, and choose **Create user**. Enter a name and,
on Valkey, pick a preset. The user's row links to its Secret.
### CLI

```sh
ezgh caches users create cch_4k2m9x0a7qpe sessions --preset readWrite --wait
ezgh caches users get cch_4k2m9x0a7qpe sessions
```

`ezgh caches users update … --preset readOnly` changes the preset, `rotate-password` writes a new
password, and `delete` deletes the user.

A user exists from the start of its create, `creating`, with its `secret` set. Names are 1–32
characters: lowercase letters, digits, `_` and `-`, starting with a letter. Names starting `ezgh_` are
reserved.

## Passwords in Secrets

Each user's Secret is named `caches/<cache ID>/users/<user>`, with the fields:

| Field | Holds |
| --- | --- |
| `username` | The user's name. |
| `password` | Its password, letters and digits. |
| `host` | The cache's endpoint. |
| `port` | The TLS port: 6379 on Valkey, 11211 on Memcached. |
| `engine` | `valkey` or `memcached`. |
| `uri` | Valkey only: a `rediss://` URL with the username, password, endpoint and port. |

The console, the CLI and the API never show a password: read it from the Secret.

```sh
ezgh secrets read sec_u1v2w3x4y5z6 --field password --format raw
```

To use it on an instance without handling it yourself, see
[Read a secret on an instance](/secrets/instances).

Creating a user writes its Secret as you, so it also needs `secrets.secrets.create` and
`secrets.versions.create` in the project.

## Rotate a password

```sh
ezgh caches users rotate-password cch_4k2m9x0a7qpe sessions --wait
```

The new password is written as a new version of the Secret and works at once; the old one stops
working for new connections. Rotating needs `secrets.versions.create`.

## Delete a user

```sh
ezgh caches users delete cch_4k2m9x0a7qpe sessions --wait
```

Deleting a user deletes its Secret as you, so it also needs `secrets.secrets.delete`. On Valkey, the
user's open connections are closed.

## Status

| Status | Means |
| --- | --- |
| `creating` | It's being created. |
| `available` | It can connect. |
| `modifying` | Its preset is changing. |
| `rotating` | Its password is being rotated. |
| `deleting` | It's being deleted. |
| `failed` | A change failed; `failure` says why. |

Source: https://docs.ezghcloud.com/caches/users/index.mdx
