Redis 安全性设置

时间:2023-03-09 12:50:22
Redis 安全性设置

redis安装好后,默认情况下登陆客户端和使用命令操作时不需要密码的。某些情况下,为了安全起见,我们可以设置在客户端连接后进行任何操作之前都要进行密码验证。

我这边是安装的window系统,修改redis.windows.conf配置文件

# Require clients to issue AUTH <PASSWORD> before processing any other
# commands. This might be useful in environments in which you do not trust
# others with access to the host running redis-server.
#
# This should stay commented out for backward compatibility and because most
# people do not need auth (e.g. they run their own servers).
#
# Warning: since Redis is pretty fast an outside user can try up to
# 150k passwords per second against a good box. This means that you should
# use a very strong password otherwise it will be very easy to break.
#
# requirepass foobared
requirepass hongda$

设置requirepass就可以

接下来要重启Redis服务

客户端授权方式

(1)登录时使用-a参数指定客户端密码,如下

Redis 安全性设置

Redis 安全性设置

(2)登录客户端后使用auth命令进行授权,如下

Redis 安全性设置

http://www.cnblogs.com/hjwublog/p/5660578.html