Latest web development tutorials

Redis security

We can set a password by redis profile parameters so that clients connected to redis service requires password authentication, so you can make your redis services more secure.

Examples

We can set the following command to check whether the password verification:

127.0.0.1:6379> CONFIG get requirepass
1) "requirepass"
2) ""

By default requirepass parameter it is empty, which means you do not need the password to login can connect to redis service.

You can modify the parameters the following command:

127.0.0.1:6379> CONFIG set requirepass "w3big"
OK
127.0.0.1:6379> CONFIG get requirepass
1) "requirepass"
2) "w3big"

After setting the password, the client connection redis service requires password authentication, or can not execute the command.

grammar

AUTH command basic syntax is as follows:

127.0.0.1:6379> AUTH password

Examples

127.0.0.1:6379> AUTH "w3big"
OK
127.0.0.1:6379> SET mykey "Test value"
OK
127.0.0.1:6379> GET mykey
"Test value"