Docker中的redis报错Failed opening the RDB file web (in server root dir /etc/cron.d) for saving: Permission denied
1.问题
最近,突然发现redis不能用了,一看日志,如下:
1:M 03 Jun 2022 10:32:22.185 # Background saving error
1:M 03 Jun 2022 10:32:28.003 * 1 changes in 3600 seconds. Saving...
1:M 03 Jun 2022 10:32:28.003 * Background saving started by pid 3591
3591:C 03 Jun 2022 10:32:28.003 # Failed opening the RDB file web (in server root dir /etc/cron.d) for saving: Permission denied
1:M 03 Jun 2022 10:32:28.104 # Background saving error
1:M 03 Jun 2022 10:32:34.023 * 1 changes in 3600 seconds. Saving...
1:M 03 Jun 2022 10:32:34.023 * Background saving started by pid 3592
3592:C 03 Jun 2022 10:32:34.024 # Failed opening the RDB file web (in server root dir /etc/cron.d) for saving: Permission denied
1:M 03 Jun 2022 10:32:34.124 # Background saving error
1:M 03 Jun 2022 10:32:40.041 * 1 changes in 3600 seconds. Saving...
1:M 03 Jun 2022 10:32:40.042 * Background saving started by pid 3593
3593:C 03 Jun 2022 10:32:40.042 # Failed opening the RDB file web (in server root dir /etc/cron.d) for saving: Permission denied
1:M 03 Jun 2022 10:32:40.142 # Background saving error
1:M 03 Jun 2022 10:32:46.060 * 1 changes in 3600 seconds. Saving...
1:M 03 Jun 2022 10:32:46.060 * Background saving started by pid 3594
3594:C 03 Jun 2022 10:32:46.061 # Failed opening the RDB file web (in server root dir /etc/cron.d) for saving: Permission denied
2.分析
我们都知道,"/etc/cron.d"目录下是和定时任务相关的文件,我使用redis的时候没用到和定时相关的东西,第一想法就是被入侵了,入侵者想添加定时任务。
3.解决方案
1.删除 authorized_keys文件里的内容,去除免密登录
2.删除/etc/cron.d目录下的定时任务文件
cd /etc/cron.d
ll
rm -rf *
3.禁止外网访问redis
在redis.conf文件中,设置如下:
bind 127.0.0.1
protected-mode yes
重启redis
标签:03,saving,opening,32,Redis,报错,2022,Jun,10 From: https://blog.51cto.com/u_15670038/5889023