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?


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

  • This worked! could you also point me to a detail explanation of why this is preventing the redis service from modifying its files? I would like to see if there's a better way than disabling this security feature completely – Tomer Amir Jun 15 '17 at 11:55
  • SElinux is kernel module which provides additional security layers. Files and directories get a context, there are also flags to configure which program can access the network to "talk" to another program. Check wiki.centos.org/HowTos/SELinux for more information. As I said my answer - I suggest you try to configure redis to work with selinux, rather than disabling it. The link in my answer contains instructions on how to do that. – 13dimitar Jun 15 '17 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.