Redis only allows local access by default, so Redis can be accessed remotely to modify redis.confOpens the redis.conf file in
NETWORKPart of the explanation
################################## NETWORK ##################################### # By default, if no "bind" Configuration directive is specified, Redis listens# for connections from all the network interfaces available on the Serv er.# It is possible to listen to just one or multiple selected interfaces using# the "bind" configuration directive, Follo Wed by one or more IP addresses.## examples:## bind 192.168.1.100 10.0.0.1# bind 127.0.0.1:: 1## ~ ~ ~ WARNING ~ ~ ~ the If the CO Mputer running Redis is directly exposed to the# Internet, binding to all the interfaces are dangerous and would expose the# Instance to everybody on the internet. So by default we uncomment the# following bind directive, that would force Redis to listen only into# the IPv4 lookback int Erface address (This means Redis would be able to# accept connections only from clients running into the same computer it# is running). # # IF You were sure you want YOUR INSTANCE to LISTEN to all the interfaces# JUST COMMENT the following Line.# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~bind 127.0.0.1 |
Workaround: Comment out bind 127.0.0.1 to enable all IP access to RedisIf you want to specify multiple IP access, but not all IP access, you can bind
NoteHere's another explanation.
# Protected mode is a layer of security protection, in order to avoid that# Redis instances left open on the Internet was accessed and exploited.## when protected mode was on and if:## 1) the server was not binding explicitly to a s Et of addresses using the# "bind" directive.# 2) No password is configured.## the server only accepts connect Ions from clients connecting to the# IPV4 and IPV6 loopback addresses 127.0.0.1 and:: 1, and from Unix domain# sockets.# # By default protected mode is enabled. You should disable it is if# you is sure you want clients from the other hosts to connect to redis# even if no Authenticati On was configured, nor a specific set of interfaces# is explicitly listed using the "Bind" Directive.protected-mode yes |
after redis3.2, Redis added Protected-mode, in this mode, even if the comment off the bind 127.0.0.1, and then access REDISD time or error, as follows
(Error) DENIED Redis is running in protected mode because protected mode are enabled, no bind address was specified, no authenticat Ion password is requested to clients. The This mode connections is only accepted from the loopback interface. If you want-to-connect from external computers to Redis-adopt one of the following solutions:1) Just disable prot ected mode sending the command ' CONFIG SET protected-mode No ' from the loopback interface by connecting to Redis from the Same host the server is running, however make sure Redis are not publicly accessible from Internet if your do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the PROTECTE d mode option to ' No ', and then restarting the server. 3) If You started the server manually just for testing, restart it with the '--protected-mode no ' option. 4) Setup A bind address or an authentication password. Note:you only NEed to does one of the above things in order for the server to start accepting connections from the outside. |
modification: Protected-mode no
Redis Open Remote Access