Failed opening the RDB file root (in server root dir /etc/crontabs) for saving: Permission denied
Asked Answered
C

2

8

I got this error when deploy docker-compose with redis

220:C 23 Jul 2020 11:21:59.091 # Failed opening the RDB file root (in server root dir /etc/crontabs) for saving: Permission denied

1:M 23 Jul 2020 11:21:59.191 # Background saving error

My docker-compose file is

version: '3'
services:
 main-otp-api:
  image: "mainotp/api:latest"
  ports:
   - "5000:5000"
 redis:
  image: "redis:alpine"
  ports:
   - "6379:6379"
  volumes: 
   - /home/mainotp-server/redis:/data
   - /home/mainotp-server/conf/redis.conf:/usr/local/etc/redis/redis.conf

Anyone can help me?

Cythera answered 23/7, 2020 at 11:36 Comment(4)
Sounds like your dockerized server has been hacked - is it open to the interwebz?Ashworth
Why do you think it was hacked? I dont know why still do not have error after i restart service redisCythera
Because the default location for RDB isn't that path, and that path is usually used by corn for running scheduled processesAshworth
yep, i try to delete user account, and try to re deploy. it's worked.Cythera
T
1

So for anyone experiencing this problem, here is a fix that will sort you out. Access the redis container shell with an interactive terminal

docker exec -it redis-container-id /bin/bash

Output will look something like this root@c4da3f40b65f:/data#.
Run cd to go the root of the file directory. Output root@c4da3f40b65f:~#.

At the root change the file permissions for /data and /etc

Run

chmod 777 -R /data  // for the data directory
chmod 777 -R /etc   // for etc folder.

You do not have to worry about the user group issues.

Tybalt answered 16/3, 2022 at 10:8 Comment(2)
but this will break all security voids. your system became vulnerableOrgeat
@Orgeat about security, i would recommend implementing redis security measures outlined in their docs. redis.io/docs/manual/security.Tybalt
T
0

My solution was to chown -R redis:redis /etc/crontabs, from inside the running Redis container. To figure out which user to put there, run top and notice who is the user for redis-server.

Theriot answered 18/10, 2023 at 15:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.