≡ Menu

Disable SELinux for only Apache / httpd in Linux

Q. How do I disable SELinux protection for only Apache web server in Linux? I’m using CentOS Linux server.

A. You can disable Apache SELinux protection easily. Please keep in mind that by disabling SELinux for apache you are inviting more security related problems.

Disable Apache SELinux Protection

Open /etc/selinux/targeted/booleans file using a text editor:
# vi /etc/selinux/targeted/booleans
Append or modify value for httpd_disable_trans as follows:
Save and close the file. Type the following two commands:
# setsebool httpd_disable_trans 1
# /etc/init.d/httpd restart

GUI tool to disable SELinux for Apache

Open a shell prompt
Type the command system-config-securitylevel
system-config-securitylevel &
Next select SELinux tab > click on Disable SELinux protection for httpd daemon checkbox > Save the changes
Finally restart httpd service:
# /etc/init.d/httpd restart

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 5 comments… add one }
  • Crazy March 24, 2008, 1:16 pm

    setsebool httpd_disable_trans 1
    Could not change active booleans: Invalid boolean

  • TDF July 10, 2008, 11:47 pm

    Did you edit the file and put the whole string in? I have done the above and it works fine if the file just contains 1.

  • snerd July 18, 2008, 6:40 am

    Sure, disabling core security features. What could possibly go wrong? Great advice there.

  • JayBat February 11, 2009, 1:41 am

    Sure, disabling core security features. What could possibly go wrong? Great advice there.

    It *is* great advice, when you’re doing an engineering environment intranet server that already runs with mostly wide-open permissions, and 30-40 TB of NetApp disk that doesn’t support chcon(). :-)

    Even if the filers did have the appropriate extended attribute support, it would be a waste of time maintaining it for that application.


  • Yo April 19, 2012, 10:13 pm

    JayBat : In this case, don’t ever bother activating SELinux.
    into /etc/selinux/config

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , , , , , , ,