search
Homephp教程php手册redis访问权限控制,密码设置

redis访问权限控制,密码设置

Jun 13, 2016 am 10:09 AM
redisintroduceaboutpasswordcontrolarticlePermissionsset upaccess

本文章来给大家介绍关于redis访问权限控制,密码设置基本步骤,有需要了解的朋友不防进入参考。

redis作为一个高速数据库,在互联网上,必须有对应的安全机制来进行保护。

1.比较安全的办法是采用绑定IP的方式来进行控制。

 代码如下 复制代码

bind 127.0.0.1

表示仅仅允许通过127.0.0.1这个ip地址进行访问。那么其实只有自己才能访问自己了,其他机器都无法访问他。

这段命令要去redis.conf里修改。

这里请注意

我们常用的启动方式src/redis-server

改为

 代码如下 复制代码
src/redis-server redis.conf

因为它需要加载配置文件。

这个方法有一点不太好,我难免有多台机器访问一个redis服务

2.设置密码,以提供远程登陆

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

写上

requirepass yourpassword设置密码以后发现可以登陆,但是无法执行命令了。

 代码如下 复制代码
src/redis-cli -h 192.168.1.121
keys *
(error) ERR operation not permitted

授权命令
auth 123456登陆带密码方式

./redis-cli -h 192.168.1.121 -a hzhutid由于redis并发能力极强,仅仅搞密码,攻击者可能在短期内发送大量猜密码的请求,很容易暴力破解,所以建议密码越长越好,比如20位。(密码在 conf文件里是明文,所以不用担心自己会忘记)

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.