Bird
Raised Fist0
Redisquery~20 mins

ACL rules and categories in Redis - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Redis ACL Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate
2:00remaining
What is the output of this ACL command?
Given the ACL rule ACL SETUSER alice on >password ~* +@all, what will be the result of the command ACL LIST for user alice?
Redis
ACL LIST
Auser alice on >password ~* +@all
Buser alice off >password ~* +@all
Cuser alice on >password ~* -@all
Duser alice on >password ~* +@read
Attempts:
2 left
💡 Hint
Remember that on means the user is enabled and +@all grants all command categories.
🧠 Conceptual
intermediate
1:30remaining
Which ACL category allows keyspace notifications commands?
In Redis ACL categories, which category includes commands related to keyspace notifications?
A@admin
B@read
C@pubsub
D@keyspace
Attempts:
2 left
💡 Hint
Keyspace notifications use the publish/subscribe system.
📝 Syntax
advanced
2:30remaining
Which ACL SETUSER command syntax is valid to allow only read commands on keys starting with 'cache:'?
Select the correct ACL SETUSER command that enables a user with password 'secret', allows only read commands, and restricts keys to those starting with 'cache:'.
AACL SETUSER bob on >secret ~cache:* +@read
BACL SETUSER bob on >secret ~cache:* +@write
CACL SETUSER bob on >secret ~cache:* +@all
DACL SETUSER bob on >secret ~cache* +@read
Attempts:
2 left
💡 Hint
The key pattern must end with a colon and asterisk to match keys starting with 'cache:'.
🔧 Debug
advanced
3:00remaining
Why does this ACL rule fail to restrict commands properly?
Consider the ACL rule: ACL SETUSER eve on >pass123 ~* +@write. Why can user 'eve' still run read commands?
ABecause the key pattern ~* allows access to all keys, ignoring command categories
BBecause +@write does not restrict read commands; it only adds write commands but does not remove read commands
CBecause the password >pass123 is invalid and disables the user
DBecause the user is off by default and must be explicitly enabled
Attempts:
2 left
💡 Hint
ACL rules add permissions but do not remove existing ones unless explicitly revoked.
❓ optimization
expert
3:00remaining
Optimizing ACL rules for minimal permissions
You want to create an ACL user that can only run the commands GET and SET on keys starting with 'app:'. Which ACL rule is the most minimal and correct?
AACL SETUSER minimal on >mypassword ~app:* +GET +SET +@all
BACL SETUSER minimal on >mypassword ~app:* +@read +@write
CACL SETUSER minimal on >mypassword ~app:* +@string
DACL SETUSER minimal on >mypassword ~app:* +GET +SET
Attempts:
2 left
💡 Hint
Use explicit command names to limit permissions precisely.

Practice

(1/5)
1. What is the main purpose of ACL rules in Redis?
easy
A. To control user access to commands and keys
B. To store data persistently on disk
C. To optimize query performance
D. To backup the database automatically

Solution

  1. Step 1: Understand ACL rules function

    ACL rules define what commands and keys a user can access in Redis.
  2. Step 2: Compare options with ACL purpose

    Only To control user access to commands and keys matches the control of user access, others describe unrelated features.
  3. Final Answer:

    To control user access to commands and keys -> Option A
  4. Quick Check:

    ACL rules = control access [OK]
Hint: ACL rules control access permissions in Redis [OK]
Common Mistakes:
  • Confusing ACL rules with data storage
  • Thinking ACL rules optimize performance
  • Mixing ACL with backup features
2. Which of the following is the correct syntax to add a user with ACL rules in Redis?
easy
A. ACL SETUSER alice on >password ~* +@all
B. ACL CREATEUSER alice on >password ~* +@all
C. ACL ADDUSER alice on >password ~* +@all
D. ACL NEWUSER alice on >password ~* +@all

Solution

  1. Step 1: Recall Redis ACL command for user creation

    The correct command to create or update a user is ACL SETUSER.
  2. Step 2: Check each option's command

    Only ACL SETUSER alice on >password ~* +@all uses ACL SETUSER, others use invalid commands.
  3. Final Answer:

    ACL SETUSER alice on >password ~* +@all -> Option A
  4. Quick Check:

    Use ACL SETUSER to add/update users [OK]
Hint: Use ACL SETUSER to add or update users [OK]
Common Mistakes:
  • Using ACL ADDUSER instead of ACL SETUSER
  • Using ACL CREATEUSER or ACL NEWUSER which don't exist
  • Confusing command names
3. Given the ACL rule ACL SETUSER bob on >mypassword ~cache:* +@read, which commands can user 'bob' execute?
medium
A. Only write commands on any keys
B. All commands including write commands
C. Only read commands on keys starting with 'cache:'
D. No commands because the user is off

Solution

  1. Step 1: Analyze the ACL rule components

    User 'bob' is enabled (on), password set, keys limited to pattern 'cache:*', and allowed commands are in category '@read'.
  2. Step 2: Determine allowed commands and keys

    Only read commands (+@read) on keys matching 'cache:*' are allowed.
  3. Final Answer:

    Only read commands on keys starting with 'cache:' -> Option C
  4. Quick Check:

    ACL keys + command categories limit access [OK]
Hint: Check key pattern and command category for user permissions [OK]
Common Mistakes:
  • Assuming all commands are allowed
  • Ignoring key pattern restrictions
  • Thinking user is disabled
4. You run ACL SETUSER alice on >pass123 ~* +@write but Alice cannot execute SET commands. What is the likely issue?
medium
A. The user is not enabled
B. The command category @write does not include SET
C. The key pattern ~* is too restrictive
D. The password is incorrect

Solution

  1. Step 1: Verify user status and rules

    User 'alice' is enabled (on), password set, keys unrestricted (~*), commands allowed in @write category.
  2. Step 2: Check if SET is in @write category

    SET command belongs to @string category, not @write, so permission is missing.
  3. Final Answer:

    The command category @write does not include SET -> Option B
  4. Quick Check:

    Command categories must include needed commands [OK]
Hint: Confirm command category includes the command you want [OK]
Common Mistakes:
  • Assuming @write includes all write commands
  • Thinking key pattern restricts commands
  • Ignoring user enabled status
5. You want to create a Redis user 'cacheAdmin' who can run all commands related to caching and keys starting with 'cache:'. Which ACL rule is correct?
hard
A. ACL SETUSER cacheAdmin on >secret ~cache:* +@read +@write
B. ACL SETUSER cacheAdmin on >secret ~cache:* +@all
C. ACL SETUSER cacheAdmin on >secret ~* +@cache
D. ACL SETUSER cacheAdmin on >secret ~cache:* +@cache +@keyspace

Solution

  1. Step 1: Identify key pattern restriction

    User must access keys starting with 'cache:', so pattern ~cache:* is needed.
  2. Step 2: Select command categories for caching

    Commands related to caching are in @cache and key management in @keyspace categories.
  3. Step 3: Evaluate options

    ACL SETUSER cacheAdmin on >secret ~cache:* +@cache +@keyspace correctly combines key pattern and relevant categories; others either allow too much or wrong keys.
  4. Final Answer:

    ACL SETUSER cacheAdmin on >secret ~cache:* +@cache +@keyspace -> Option D
  5. Quick Check:

    Use key pattern + relevant categories for precise access [OK]
Hint: Combine key patterns with correct categories for precise ACL [OK]
Common Mistakes:
  • Using ~* allows all keys, not just cache keys
  • Using +@all grants too many permissions
  • Missing key pattern restriction
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard