config get requirepass"."> How to view redis password-Redis-php.cn
Home> Database> Redis> body text

How to view redis password

藏色散人
Release: 2021-02-09 09:18:15
Original
34358 people have browsed it

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
Copy after login

Query password:

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

Password verification:

redis 127.0.0.1:6379> auth test123 OK
Copy after login

Query again:

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

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
Copy after login

Log in first and then verify:

redis-cli -p 6379 redis 127.0.0.1:6379> auth test123 OK
Copy after login

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 theRedis usage tutorialcolumn!

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!