Home >Backend Development >PHP Tutorial >redis access permission control, password setting_PHP tutorial

redis access permission control, password setting_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:06:321218browse

This article will introduce you to the basic steps of redis access permission control and password setting. Friends who need to know more can refer to it.

As a high-speed database, redis must have corresponding security mechanisms to protect it on the Internet.

1. A safer way is to control by binding IP.

The code is as follows
 代码如下 复制代码

bind 127.0.0.1

Copy code

bind 127.0.0.1

means that only access through the IP address 127.0.0.1 is allowed. Then in fact, only you can access yourself, and no other machines can access him.

This command needs to be modified in redis.conf.
 代码如下 复制代码
src/redis-server redis.conf

Please note here

Our common startup method is src/redis-server

changed to

 代码如下 复制代码
redis.conf
找到
requirepass

Because it needs to load the configuration file.

This method is not very good. It is inevitable that I have multiple machines accessing a redis service

 代码如下 复制代码
src/redis-cli -h 192.168.1.121
keys *
(error) ERR operation not permitted
2. Set a password to provide remote login


Write

requirepass yourpassword After setting the password, I found that I can log in, but cannot execute the command.
Authorization command auth 123456 login with password

./redis-cli -h 192.168.1.121 -a hzhutid Due to the extremely strong concurrency capability of redis, attackers may send a large number of password guessing requests in a short period of time, which is easy to crack through brute force, so it is recommended that the password be longer. The better, like 20 digits. (The password is in clear text in the conf file, so don’t worry about forgetting it) http://www.bkjia.com/PHPjc/630681.htmlwww.bkjia.comtrue
http: //www.bkjia.com/PHPjc/630681.html
TechArticle
This article will introduce you to the basic steps of redis access permission control and password setting. Friends who need to know are not advised. Enter reference. As a high-speed database, redis, on the Internet,...
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