Redis – `CONFIG REWRITE failed: Permission denied`

centos7permissionsredisservice

I am trying to install and configure a redis service on centos7.

redis tries to rewrite its configuration file from time to time with no success, so it throws the following error:

CONFIG REWRITE failed: Permission denied

the file exists in /etc/redis.conf, and it's permissions are:

-rw-r--r--. 1 redis redis 46765 Jun 13 06:20 /etc/redis.conf

I even tried to change the permission to chmod 777 /etc/redis.conf, and that did not fix the issue.

redis runs under the user redis.

How can I fix this?

Best Answer

Most certainly you have issues with SElinux. Either disable it (which I don't recommend) with setenforce 0 for a temp disable, or change the permissive/disabled mode in /etc/selinux/config for a permanent "solution".

What you should do is configure SElinux to allow redis to work - I suggest you start from here: Unable to start Redis under SELinux