# ACL LOAD

> Replace the in-memory ACL users with the ones in the configured aclfile.

URL: https://docs.hotkv.com/commands/acl-load/

```
ACL LOAD
```

- Group: ACL
- Complexity: O(N) where N is the number of users in the file
- HotKV Cloud: all plans
- On-Premise: no license needed

`ACL LOAD` reads the file set with the `aclfile` directive and replaces the
users in memory with the ones it defines. Use it after editing the file by
hand. Clients whose user was removed or lost permissions are handled as if
the change came from [ACL SETUSER](https://docs.hotkv.com/commands/acl-setuser/index.md) or
[ACL DELUSER](https://docs.hotkv.com/commands/acl-deluser/index.md): clients of a user that no longer
exists are disconnected.

The whole file is checked first. If any line is invalid, nothing changes
and the error names the line. If the file does not define the `default`
user, the current `default` user is kept, so a server protected by
`requirepass` stays protected.

Each line has the form `user <name> [rule ...]`, with the rules of
`ACL SETUSER`. Empty lines and lines starting with `#` are skipped.

## Return value

Simple string `OK` in RESP2 and RESP3, or one of these errors:

| Case | Error |
| --- | --- |
| No `aclfile` configured | `ERR This HotKV instance was not configured with an aclfile. Set 'aclfile <path>' in the config to persist ACL users.` |
| The file cannot be read | `ERR Cannot open '<path>' for reading: <reason>` |
| A line that is not `user <name> ...` | `ERR Error in line <n>: expected 'user <name> [rules...]'` |
| An invalid rule | `ERR Error in line <n>: '<rule>': <reason>` |
| A user defined twice | `ERR Error in line <n>: user '<name>' is defined more than once` |

## Examples

```
127.0.0.1:6379> ACL LOAD
OK
127.0.0.1:6379> ACL LOAD
(error) ERR Error in line 3: '+nosuchcommand': Unknown command or category name in ACL
```

## Compatibility

Same behaviour as Redis 7 and Valkey 8, including the all-or-nothing load.
The error texts differ.

## See also

[ACL SAVE](https://docs.hotkv.com/commands/acl-save/index.md), [ACL LIST](https://docs.hotkv.com/commands/acl-list/index.md),
[ACL SETUSER](https://docs.hotkv.com/commands/acl-setuser/index.md)