I've configured redis-server to use password with requirepass
option.
When running redis-cli
I have two options to gain access to database.
redis-cli -a mypassword
command. This stores passsword inbash history.
Every time I run it, I need to delete history entry.AUTH mypassword
inside redis-cli. This option unfortunately saves your password in redis-cli, and you can look it by pressing up arrow even if you login to redis-cli without any authentication. It is literally accessible without any protection.What is the proper way to authenticate redis-cli?
You may set the password in REDISCLI_AUTH
environment variable prior to invoking redis-cli
. Once the variable is set, you could access redis-cli
without specifying the password with -a
switch. The redis-cli
would use the password set in REDISCLI_AUTH
while connecting to Redis server.
export REDISCLI_AUTH=your_secret_password
redis-cli -h hostname -p portnumber
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With