Back to results for “Permissions”
Redis › Redis Security & ACL

How do you create a Redis ACL user with permissions restricted to only specific commands and a specific pattern of keys?

Intermediate

Answer

You use the ACL SETUSER command, specifying the username, enabling the user, setting a password, and then defining exactly which key patterns they can access using the tilde symbol and which commands they are allowed to run using plus signs for allowed commands and minus signs to explicitly deny others.
ACL SETUSER app_user on >secure_password ~app:* +get +set +del -flushall
Real-world example An application specific user is created with access limited to only keys prefixed with app, and permission to use get, set, and del, while being explicitly denied the ability to run the dangerous flushall command that would wipe the entire database.

Common follow-ups: What happens if a user tries to run a command they have been explicitly denied?;How do you view the complete list of permissions currently assigned to a specific user?