0
0
Redisquery~5 mins

Protected mode in Redis

Choose your learning style9 modes available
Introduction

Protected mode helps keep your Redis server safe by limiting access to it. It stops strangers from connecting and changing your data.

When you run Redis on your computer and want to prevent others on the same network from accessing it.
When you start Redis without setting a password and want a safety net to avoid accidental access.
When you want to test Redis locally but avoid exposing it to the internet.
When you deploy Redis on a server but haven't configured security yet.
When you want to quickly check if Redis is protected from outside connections.
Syntax
Redis
protected-mode yes|no

Use yes to enable protected mode (default).

Use no to disable protected mode, but only if you know what you are doing.

Examples
This enables protected mode, so Redis only accepts connections from trusted sources.
Redis
protected-mode yes
This disables protected mode, allowing Redis to accept connections from anywhere. Use with caution.
Redis
protected-mode no
Sample Program

This example shows starting Redis with protected mode on. If you try to connect from another machine without a password, Redis will refuse the connection.

Redis
# Start Redis server with protected mode enabled (default)
redis-server --protected-mode yes

# Try to connect from another machine without authentication
redis-cli -h <server-ip> ping
OutputSuccess
Important Notes

Protected mode is on by default to keep Redis safe.

If you disable protected mode, make sure to set a strong password and firewall rules.

Protected mode blocks connections from outside localhost unless a password is set or specific bind addresses are configured.

Summary

Protected mode helps protect your Redis server from unauthorized access.

It is enabled by default and should only be disabled with proper security measures.

Always use protected mode or other security settings when running Redis on a network.