Disable SELinux for only Apache / httpd in Linux

by Vivek Gite · 4 comments

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:
httpd_disable_trans=1
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

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 4 comments… read them below or add one }

1 Crazy 03.24.08 at 1:16 pm

setsebool httpd_disable_trans 1
Could not change active booleans: Invalid boolean

2 TDF 07.10.08 at 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.

3 snerd 07.18.08 at 6:40 am

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

4 JayBat 02.11.09 at 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.

Jay

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous FAQ:

Next FAQ:

nixCraft FAQ PDF Collection Now Available To All