config get requirepass"."/> config get requirepass".">

Home  >  Article  >  Database  >  How to view redis password

How to view redis password

藏色散人
藏色散人Original
2019-08-19 13:47:2934537browse

How to view redis password

How to check the redis password?

Redis does not implement access control, but it provides a lightweight authentication method. You can edit the redis.conf configuration to enable authentication.

1. Initialize Redis password:

There is a parameter in the configuration file: requirepass This is the parameter to configure the redis access password;

For example, requirepass test123;

(Ps: Redis needs to be restarted to take effect)

The query speed of redis is very fast. External users can try up to 150K passwords in one second; so the password should be as long as possible (for DBA, no You must remember the password if necessary);

2. Set the password without restarting Redis:

Configure the requirepass password in the configuration file (the password is still valid when redis is restarted).

   redis 127.0.0.1:6379> config set requirepass test123

Query password:

 redis 127.0.0.1:6379> config get requirepass
   (error) ERR operation not permitted

Password verification:

   redis 127.0.0.1:6379> auth test123
   OK

Query again:

   redis 127.0.0.1:6379> config get requirepass
   1) "requirepass"
   2) "test123"

PS: If the password is not added in the configuration file, then redis will restart , the password is invalid;

3. Log in to Redis with a password:

Enter the password when logging in:

redis-cli -p 6379 -a test123

Log in first and then verify:

 redis-cli -p 6379
 redis 127.0.0.1:6379> auth test123
 OK

AUTH command, like other redis commands, is not encrypted; it cannot prevent attackers from stealing your password on the network;

The goal of the authentication layer is to provide an additional layer of protection. If the firewall or the system used to protect redis fails to defend against external attacks, external users will still be unable to access redis without passing password authentication.

For more Redis related knowledge, please visit the Redis usage tutorial column!

The above is the detailed content of How to view redis password. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to install RedisNext article:How to install Redis