Configure Redis Password

Configuring a Redis password enables one of its two built-in security feature - the auth command, which requires clients to authenticate to access the database. The password is configured directly in Redis's configuration file, /etc/redis/redis.conf, which you should still have open from the previous step.

Scroll to the SECURITY section and look for a commented directive that reads:

vi /etc/redis.conf
# requirepass foobared
Uncomment it by removing the #, and change foobared to a very strong and very long value. 

Restart Redis

service redis restart

if your startup script is using below command to shutdown redis:

vi /etc/init.d/redis
$CLIEXEC -h $HOST -p $REDISPORT shutdown

Remember to change to the below:
$CLIEXEC -h $HOST -p $REDISPORT -a $PW shutdown

To login Redis with password, use the command below:

redis-cli -h  -p  -a 

Be the first to comment

Leave a Reply

Your email address will not be published.


*