How to set up password protection in Redis?
To enable password protection in Redis, you can follow these steps:
- Open the Redis configuration file (usually located in the /etc/redis/ directory) by using the following command:
sudo nano /etc/redis/redis.conf
- Find and remove the comments from the following lines, or add the following lines:
requirepass yourpassword
Replace yourpassword with the password you want to set.
- Save and close the file.
- Restart the Redis service to apply the password protection configuration.
sudo systemctl restart redis
- After completion, you will need to enter a password when logging into Redis using Redis-cli.
redis-cli -a yourpassword
This way, you can set up password protection in Redis.