Advertisement
Beginner Redis, Redis Security & ACL

How do you set a password to require authentication before clients can execute commands on a Redis instance?

Short answer

You set the requirepass configuration option to a strong password value, after which any client attempting to connect must first successfully authenticate using the AUTH command with that exact password before it will be allowed to run any other commands against the server.

Save Redis mock interview
Advertisement
AModel answer
You set the requirepass configuration option to a strong password value, after which any client attempting to connect must first successfully authenticate using the AUTH command with that exact password before it will be allowed to run any other commands against the server.
Example

CONFIG SET requirepass 'a_very_strong_password' -- Clients must then authenticate first AUTH a_very_strong_password

Real-world example
A company enables password authentication on their Redis instance before deploying it to production, ensuring anyone who somehow gains network access still cannot read or modify data without knowing the correct password.
Likely follow-ups
  • Where is the safest place to store this password for an application to use?
  • What happens if a client tries to run a command without first authenticating?
Related topics