Can't make SELinux context types permanent with semanage

Posted by Safado on Server Fault See other posts from Server Fault or by Safado
Published on 2013-11-08T17:39:27Z Indexed on 2013/11/09 4:00 UTC
Read the original article Hit count: 479

Filed under:
|

I created a new folder at /modevasive to hold my mod_evasive scripts and for the Log Directory. I'm trying to change the context type to httpd_sys_content_t so Apache can write to the folder. I did semanage fcontext -a -t "httpd_sys_content_t" /modevasive to change the context and then restorecon -v /modevasive to enable the change, but restorecon didn't do anything. So I used chcon to change it manually, did the restorecon to see what would happen and it changed it back to default_t.

semanage fcontext -l gives:

/modevasive/          all files          system_u:object_r:httpd_sys_content_t:s0`

And looking at /etc/selinux/targeted/contexts/files/file_contexts.local gives

 /modevasive/    system_u:object_r:httpd_sys_content_t:s0

So why does restorecon keep setting it back to default_t?

© Server Fault or respective owner

Related posts about rhel6

Related posts about selinux