Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Redis password setting and the method of viewing password

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Redis does not implement access control, but it provides a lightweight authentication method that allows you to edit redis.conf configuration to enable authentication.

1. Initialize the Redis password:

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

Like requirepass test123.

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

Redis query speed is very fast, external users can try as many as 150K passwords in a second; so passwords should be as long as possible (it is not necessary for DBA to remember passwords)

2. Do not restart Redis to set the password:

Configure the password for requirepass 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 redis 6379 > config get requirepass (error) ERR operation not permitted

Password authentication:

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 no password is added in the configuration file, the password will become invalid after redis restart

3. Log in to Redis with password:

Enter the password when logging in:

Redis-cli-p 6379-a test123

Log in before verification:

Redis-cli-p 6379

Redis 127.0.0.1 6379 > auth test123

OK

The AUTH command, like other redis commands, is unencrypted; it does not 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 not be able to access redis without password authentication.

Summary

The above is the method of setting the Redis password and checking the password. I hope it will be helpful to you. If you have any questions, please leave a message for me, and the editor will reply you in time. Thank you very much for your support to the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report