About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
A client on another machine gets -DENIED Redis is running in protected mode because protected mode is enabled and no password is set for the default user. Redis is working as designed: protected mode is on, nobody set a password, and only connections from the same host are accepted. The safe fix is a password for the default user, with the Redis port limited to the hosts that need it. Switching protected mode off is the last option, not the first.
What the error means
The Redis security page says Redis "is designed to be accessed by trusted clients inside trusted environments" and warns that "a single FLUSHALL command can be used by an external attacker to delete the whole data set". Since version 3.2.0, Redis enters protected mode when it runs "with the default configuration (binding all the interfaces) and without any password". In that mode "Redis only replies to queries from the loopback interfaces, and replies to clients connecting from other addresses with an error".
The redis.conf file states the condition this way: "When protected mode is on and the default user has no password, the server only accepts local connections from the IPv4 address (127.0.0.1), IPv6 address (::1) or Unix domain sockets." Protected mode is on by default.
The error text and the check below come from the Redis source code, releases 8.0.6 and 7.2.17, which agree. The check tests three things: the protected-mode setting is on, the default user is flagged nopass, and the connecting peer is not a local one. It does not look at the bind setting. So a bind line on its own does not clear the error. The message text lists four ways out. Three of them turn protection off: CONFIG SET protected-mode no from the loopback interface, editing the configuration file, and starting the server with --protected-mode no, which the message says is for testing. The fourth sets an authentication password for the default user.
The sample redis.conf binds only to loopback by default (bind 127.0.0.1 -::1 in the 8.0.6 file). If a remote client reaches Redis at all, something is listening on a non-loopback address. That may be a changed bind line, a container port mapping, or a server started without a configuration file.
Likely causes
| Cause | What you see | How to confirm |
|---|---|---|
| No password on the default user, remote client | The DENIED text from one host, success from the Redis host itself | ACL GETUSER default shows the nopass flag |
| Application moved to a different host or container | It worked on the same machine and failed after the move | The client address is not loopback |
bind widened to reach other hosts, password not set |
Port reachable, then DENIED | CONFIG GET bind shows more than loopback |
| Wrong config file loaded | The password you set has no effect | INFO server reports a different config_file |
requirepass set but aclfile or ACL LOAD in use |
Default user still has nopass |
The redis.conf says requirepass "is not compatible with aclfile" and is ignored in that case |
Prove the cause before changing anything
All of these are read-only. Run the server-side commands on the Redis host.
1. Reproduce from the client.
redis-cli -h 192.0.2.20 -p 6379 PING
The redis-cli manual says -h sets the host name or address and -p the port. A good result is PONG. In this case the reply is the DENIED text.
2. Does the default user have a password?
redis-cli ACL GETUSER default
The ACL GETUSER page lists flags, password hashes, commands and keys. If the flags include nopass, any client authenticates as the default user without a password, and protected mode is what stops remote ones. If nopass is absent and passwords are listed, protected mode does not apply and the error has another cause.
3. Is protected mode on, and where does Redis listen?
redis-cli CONFIG GET protected-mode
redis-cli CONFIG GET bind
ss -ltnp
CONFIG GET reads parameters from a running server. For ss, -l lists listening sockets, -t selects TCP, -n prints numbers and -p shows the process. Find the line for the Redis port and read the local address. Loopback means Redis cannot be reached from other hosts at all.
4. Which configuration file is running?
redis-cli INFO server
The config_file field holds "The path to the config file" and tcp_port the listen port. Edit that file, not another one.
Fix
Work in this order. The first fix adds a password. The second limits where Redis listens. Do both.
Set a password for the default user
The redis.conf file says that since Redis 6 requirepass "is just a compatibility layer on top of the new ACL system", and its effect "will be just setting the password for the default user". The AUTH page recommends a long password and says "A good way to generate strong passwords is via the ACL GENPASS command."
First save the current file. The path is an example; use the config_file value from step 4:
cp -p /etc/redis/redis.conf /etc/redis/redis.conf.2026-11-22
Disruptive step: the next edit and restart disconnect every client. Once the password is set, any client without it is refused with NOAUTH Authentication required, so every application must be given the password before or straight after the restart.
Add the line requirepass followed by the password to the file. Keep the password out of shell history and chat messages. The file is read at start-up, so restart Redis. List the unit first, because the name differs between distributions:
systemctl list-units 'redis*'
systemctl restart redis-server
To back out: put the saved file back under its own name and restart.
cp -p /etc/redis/redis.conf.2026-11-22 /etc/redis/redis.conf
systemctl restart redis-server
Give each client the password. For redis-cli, the manual says to provide the password "via the REDISCLI_AUTH environment variable" and calls that more safe than -a, and --askpass prompts for it. Applications take it in their own settings.
Limit where Redis listens
The redis.conf file shows the form bind 192.168.1.100 10.0.0.1 for several addresses, and warns that binding every interface is dangerous on a host exposed to the internet. The security page adds that Redis should be reachable only by the computers that run the application, and that a firewall should block everything else.
First save the current file under a second name:
cp -p /etc/redis/redis.conf /etc/redis/redis.conf.2026-11-22-bind
Disruptive step: the next edit and restart disconnect every client. A wrong address means Redis does not start or cannot be reached.
Set the bind line to loopback plus the one private address the application uses, then restart. Put the line in redis.conf and run the restart:
bind 127.0.0.1 192.0.2.20
systemctl restart redis-server
To back out: restore the second saved copy and restart.
cp -p /etc/redis/redis.conf.2026-11-22-bind /etc/redis/redis.conf
systemctl restart redis-server
The security page recommends that the Redis port be firewalled so that only the application hosts reach it, and a bind line does not replace that. The firewall tool differs between hosts, so the rule is outside this procedure.
Turn protected mode off (last resort)
The error text allows CONFIG SET protected-mode no from the same host. Use it only when the network already blocks everyone except trusted hosts.
First print the current value and keep it:
redis-cli CONFIG GET protected-mode
Risk: the next command lets any host that can reach the port run any command with no password, including FLUSHALL. The error text itself says "MAKE SURE Redis is not publicly accessible from internet if you do so."
redis-cli CONFIG SET protected-mode no
It takes effect at the next command and is lost at restart unless you also use CONFIG REWRITE, which writes the running configuration back to the file. To undo it: run redis-cli CONFIG SET protected-mode yes if the value you printed was yes.
Example (illustrative): redis01 (192.0.2.20) serves app.example.com (198.51.100.15). After the application moves from the Redis host to its own server, it logs the DENIED text. ACL GETUSER default on redis01 shows nopass, CONFIG GET protected-mode returns yes, and CONFIG GET bind shows more than loopback. The engineer saves redis.conf, adds requirepass with a generated password, sets bind 127.0.0.1 192.0.2.20, restarts Redis, puts the password in the application's settings and restricts port 6379 to 198.51.100.15 in the firewall. PING with the password set in REDISCLI_AUTH returns PONG.
Confirm the fix
- From the client host,
PINGwith the password returnsPONG. - Without the password, a command returns
NOAUTH Authentication required, not the DENIED text. redis-cli ACL GETUSER defaultno longer lists thenopassflag.- A host not in the allow list cannot open the port.
- After the next restart the same checks still pass.
What to watch afterwards
- Treat the password as a secret in your configuration management. The security page notes that the
redis.confpassword is stored in clear text, so protect the file. - The password travels unencrypted unless you add TLS. The security page says
AUTH"does not protect against an attacker who has enough access to the network to perform eavesdropping". - Prefer named ACL users for applications. The security page calls ACLs the recommended method.
- Update the firewall rule when an application moves host.
Read next
Related articles you may want next.
- TroubleshootingRedis OOM command not allowed when used memory > 'maxmemory'Redis OOM command not allowed when used memory > 'maxmemory': read INFO memory, pick the right eviction policy, set TTLs or raise the limit safely.Read article
- TroubleshootingRedis MISCONF: unable to persist to disk (RDB snapshots failing, writes refused)Redis MISCONF Redis is configured to save RDB snapshots but is unable to persist to disk: find the failed BGSAVE cause and restore writes safely.Read article
- Backup & RecoveryRedis backups: RDB snapshots, the append-only file and what a restore really gives youHow Redis persistence works for backup: RDB snapshots, the append-only file, safe copying, newer backup commands, replication risks and restore checks.Read article
Risks and limits
- These commands have not been run or lab-tested.
- The wording and the check are from the Redis source code at releases 8.0.6 and 7.2.17. Other releases may word the message differently.
- The documentation describes Redis Open Source. Redis Software, Redis Cloud and managed services follow their own rules.
- A restart ends every client connection. Check how your instance persists its data before you restart it.
Sources
- Redis security — Redis documentation, page metadata modified 2026-09-30, accessed 22 November 2026
- redis.conf (release 8.0.6) — Redis source code, release tag 8.0.6, no date shown, accessed 22 November 2026
- networking.c (release 8.0.6) — Redis source code, release tag 8.0.6, no date shown, accessed 22 November 2026
- networking.c (release 7.2.17) — Redis source code, release tag 7.2.17, no date shown, accessed 22 November 2026
- AUTH — Redis documentation, page metadata modified 2026-09-18, accessed 22 November 2026
- ACL — Redis documentation, page metadata modified 2026-10-13, accessed 22 November 2026
- ACL GETUSER — Redis documentation, page metadata modified 2026-09-18, accessed 22 November 2026
- CONFIG GET — Redis documentation, page metadata modified 2026-09-18, accessed 22 November 2026
- CONFIG SET — Redis documentation, page metadata modified 2026-09-18, accessed 22 November 2026
- CONFIG REWRITE — Redis documentation, page metadata modified 2026-09-18, accessed 22 November 2026
- redis-cli — Redis documentation, page metadata modified 2026-09-11, accessed 22 November 2026
- INFO — Redis documentation, page metadata modified 2026-09-18, accessed 22 November 2026
- ss(8) — iproute2 manual page, repository read 2026-08-04 (latest commit 2026-07-28), accessed 22 November 2026
- cp(1) — GNU coreutils 9.11 manual page, April 2026, accessed 22 November 2026
- systemctl — systemd manual, no date shown, accessed 22 November 2026
This article was originally published on .