ACL DELUSER

Introduction and Use Case(s)

ACL DELUSER is a Redis command used to delete user accounts from the ACL (Access Control List) system. This command is critical for managing security and permissions within your Redis instance. Typical use cases include removing outdated or compromised user accounts, and maintaining a clean and secure user environment.

Syntax

  1. ACL DELUSER username [username ...]

Parameter Explanations

  • username: The name of the user(s) you wish to delete. You can specify multiple usernames separated by spaces.

Return Values

The command returns the number of users that were successfully removed.

Example outputs:

  • (integer) 1 if one user was deleted.
  • (integer) 0 if no users were found with the specified names.

Code Examples

  1. dragonfly> ACL LIST
  2. 1) "user default on nopass ~* +@all"
  3. 2) "user guest off nopass ~* -@all"
  4. 3) "user admin on >password ~* +@all"
  5. dragonfly> ACL DELUSER guest
  6. (integer) 1
  7. dragonfly> ACL LIST
  8. 1) "user default on nopass ~* +@all"
  9. 2) "user admin on >password ~* +@all"
  10. dragonfly> ACL DELUSER nonexistinguser
  11. (integer) 0

Best Practices

  • Always ensure you are deleting the correct user by listing users with ACL LIST before deletion.
  • Regularly review your ACL to remove any redundant or unnecessary users.

Common Mistakes

  • Attempting to delete a user that does not exist will return (integer) 0 and may lead to confusion. Double-check usernames before executing the command.

FAQs

What happens if I try to delete multiple users at once and some do not exist?

The command will still execute and delete the existing users, returning the count of users that were actually deleted.

Can I delete the default user?

No, the default user cannot be deleted. It is a built-in account necessary for Redis operation.