# ACL SAVE

> Write the in-memory ACL users to the configured aclfile.

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

```
ACL SAVE
```

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

`ACL SAVE` writes every user, in the [ACL LIST](https://docs.hotkv.com/commands/acl-list/index.md) format,
to the file set with the `aclfile` directive. The file is written to a
temporary file first and then renamed over the old one, so a failed save
leaves the previous file intact. Users are kept in memory only until you
save them, so run `ACL SAVE` after changing users if they should survive a
restart.

## 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 could not be written | `ERR Cannot open '<path>' for writing: <reason>`, or another message naming the step that failed |

## Examples

```
127.0.0.1:6379> ACL SETUSER reports on >reports-password ~report:* -@all +@read
OK
127.0.0.1:6379> ACL SAVE
OK
```

## Compatibility

Same as Redis 7 and Valkey 8. The error texts differ.

## See also

[ACL LOAD](https://docs.hotkv.com/commands/acl-load/index.md), [ACL LIST](https://docs.hotkv.com/commands/acl-list/index.md)