Hey all, I have a simple php app working that writes some info to a text file. The app will only work correctly if SELinux is disabled. If it's enabled and try to use the app, it fails. It seems that SELinux is denying the app ability to write to the text file. So I tried running the following command: chcon -R -t httpd_sys_content_t /var/www And tried veriying the command with the following: ls -RZ /var/www And everything seems to be in order. For example I see: -rw-r--r--. apache apache system_u:object_r:httpd_sys_content_t:s0 vieworders.php But the app stil won't function correctly unless SELinux is set to off. What can I do to get it work with it enabled? Thanks Tim -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
Have you tried changing the folder where it's writing into with these lables? httpd_sys_content_rw_t or httpd_user_content_rw_t On Thu, Jan 22, 2015 at 11:09 AM, Tim Dunphy <bluethundr at gmail.com> wrote:> Hey all, > > I have a simple php app working that writes some info to a text file. The > app will only work correctly if SELinux is disabled. If it's enabled and > try to use the app, it fails. It seems that SELinux is denying the app > ability to write to the text file. > > So I tried running the following command: > > chcon -R -t httpd_sys_content_t /var/www > > And tried veriying the command with the following: > > ls -RZ /var/www > > And everything seems to be in order. For example I see: > > -rw-r--r--. apache apache system_u:object_r:httpd_sys_content_t:s0 > vieworders.php > > But the app stil won't function correctly unless SELinux is set to off. > What can I do to get it work with it enabled? > > Thanks > Tim > -- > GPG me!! > > gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >
Hey Jeremy,> Have you tried changing the folder where it's writing into with these > lables? httpd_sys_content_rw_t or httpd_user_content_rw_tAdding 'rw' to the command did the trick. I tried httpd_sys_content_rw_t and that works fine! Thanks for the tip! Tim On Thu, Jan 22, 2015 at 1:19 PM, Jeremy Hoel <jthoel at gmail.com> wrote:> Have you tried changing the folder where it's writing into with these > lables? httpd_sys_content_rw_t or httpd_user_content_rw_t > > On Thu, Jan 22, 2015 at 11:09 AM, Tim Dunphy <bluethundr at gmail.com> wrote: > > > Hey all, > > > > I have a simple php app working that writes some info to a text file. > The > > app will only work correctly if SELinux is disabled. If it's enabled and > > try to use the app, it fails. It seems that SELinux is denying the app > > ability to write to the text file. > > > > So I tried running the following command: > > > > chcon -R -t httpd_sys_content_t /var/www > > > > And tried veriying the command with the following: > > > > ls -RZ /var/www > > > > And everything seems to be in order. For example I see: > > > > -rw-r--r--. apache apache system_u:object_r:httpd_sys_content_t:s0 > > vieworders.php > > > > But the app stil won't function correctly unless SELinux is set to off. > > What can I do to get it work with it enabled? > > > > Thanks > > Tim > > -- > > GPG me!! > > > > gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B > > _______________________________________________ > > CentOS mailing list > > CentOS at centos.org > > http://lists.centos.org/mailman/listinfo/centos > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >-- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B