Using acl with redis-cli

I was setting up a Redis server and ACL configuration and I was wondering, how to connect to this instance with redis-cli, the command line client.

Searching the internet did not help, as most examples only show, how to pass the password by using the -a parameter. And using the -a parameter does not work, because it only accepts the password, and not the username. So it is not passing through the given value to the AUTH command.

But the help page gave me the clue to me. For example call docker run --rm redis:6.0.5-alpine redis-cli --help to display the help.

So lets say you have setup a user myuser with password myS3cret, then you can call redis-cli as such: docker run --rm redis:6.0.5-alpine redis-cli --user myuser --pass myS3cret ping and you will receive

Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
PONG

Happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.