You are on page 1of 14

10/9/21, 5:53 AM How to Disable SELinux Temporarily or Permanently

Learn Linux in One Week and Go From Zero to Hero - Get This Book


Menu


Menu 

How to Disable SELinux Temporarily or Permanently

Aaron Kili Last Updated: July 25, 2019 Linux Commands 5 Comments

Ad
aaPanel - Linux control panel

aaPanel Open

Linux is regarded as one of the most secure operating systems you can use today, that is because of its illustrious
security implementation features such as SELinux (Security-Enhanced Linux).

Disable SELinux in CentOS, RHEL and Fedora

left: 549px; top: 32px;height: 15px;width: 60px;


For starters,ssssss
SELinux is described as a mandatory access control (MAC)
25 security structure
Male executed in the kernel.

SELinux offers a means of enforcing some security policies which would otherwise No
not be effectively implemented
Rs 740
https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ 1/14
10/9/21, 5:53 AM How to Disable SELinux Temporarily or Permanently

by a System Administrator.

When you install RHEL/CentOS or several derivatives, the SELinux feature or service is enabled by default, due to
this some applications on your system may not actually support this security mechanism. Therefore, to make such
applications function normally, you have to disable or turn off SELinux.

Important: If you don’t want to disable SELinux, then you should read the following articles to implement some
mandatory access control on files and services to function properly.

Don’t Miss: Setup Mandatory Access Control with SELinux in Linux

Don’t Miss: Implement Mandatory Access Control with SELinux and AppArmor in Linux

In this how-to guide, we shall walk through steps you can follow to check the status of SELinux and also disable
SELinux in CentOS/RHEL and Fedora, in case it is enabled.

How Can I Disable SELinux in Linux

Ad
aaPanel - Linux control panel

aaPanel Open

The first thing to do is to check the status of SELinux on your system, and you can do this by running the following
command:

$ sestatus

Check Status of SELinux

Next, proceed to disabling SELinux on your system, this can be done temporarily or permanently depending on what
you want toleft: 549px; top: 32px;height: 15px;width: 60px;
achieve.
ssssss 25 Male

No

Rs 740
https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ 2/14
10/9/21, 5:53 AM How to Disable SELinux Temporarily or Permanently

Disable SELinux Temporarily

To disable SELinux temporarily, issue the command below as root:

# echo 0 > /selinux/enforce

Alternatively, you can use the setenforce tool as follows:

# setenforce 0

Else, use the Permissive option instead of 0 as below:

# setenforce Permissive

These methods above will only work until the next reboot, therefore to disable SELinux permanently, move to the
next section.

Disable SELinux Permanently

To permanently disable SELinux, use your favorite text editor to open the file /etc/sysconfig/selinux as
follows:

# vi /etc/sysconfig/selinux

SELinux Enforcing Mode

left: 549px; top: 32px;height: 15px;width: 60px;


ssssss
Then change the directive SELinux=enforcing to SELinux=disabled
25
as shownMale
in the below image.
No

Rs 740
https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ 3/14
10/9/21, 5:53 AM How to Disable SELinux Temporarily or Permanently

SELINUX=disabled

Disable SELinux Permanently

Then, save and exit the file, for the changes to take effect, you need to reboot your system and then check the status
of SELinux using sestatus command as shown:

$ sestatus

Check SELinux Status

In conclusion, we moved through the simple steps you can follow to disable SELinux on CentOS/RHEL and Fedora.
There is nothing much to cover under this topic but additionally, finding out more about SELinux can prove helpful
especially for those interested in exploring security features in Linux.

 Linux Tricks

 How to Fix “Cannot find a valid baseurl for repo” in How to Add Swap Space on Ubuntu 
CentOS

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts?
do ask for help in the comments section.

left: 549px; top: 32px;height: 15px;width: 60px;


ssssss 25 Male

No

Rs 740
https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ 4/14
10/9/21, 5:53 AM How to Disable SELinux Temporarily or Permanently

Ad
aaPanel - Linux control panel

aaPanel Open

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux
Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse
the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of
appreciation.

We are thankful for your never ending support.

Related Posts

left: 549px; top: 32px;height: 15px;width: 60px;


ssssssExamples of ‘echo’ command in Linux
15 Practical 25 Male

No

Rs 740
https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ 5/14
10/9/21, 5:53 AM How to Disable SELinux Temporarily or Permanently

15 Basic ‘ls’ Command Examples in Linux

3 Ways to Find Out Which Process Listening on a Particular Port

left: 549px; top: 32px;height: 15px;width: 60px;


ssssss 25 Male

No

Rs 740
https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ 6/14
10/9/21, 5:53 AM How to Disable SELinux Temporarily or Permanently

16 Top Command Examples in Linux [Monitor Linux Processes]

10 Commands to Collect System and Hardware Info in Linux

left: 549px; top: 32px;height: 15px;width: 60px;


ssssss 25 Male

No

Rs 740
https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ 7/14
10/9/21, 5:53 AM How to Disable SELinux Temporarily or Permanently

10 sFTP Command Examples to Transfer Files on Remote Servers in Linux

5 thoughts on “How to Disable SELinux Temporarily or


Permanently”

Farhad
July 27, 2021 at 1:29 pm

When you change /etc/sysconfig/selinux, the SELINUX kernel module still will be loaded, just won’t enforce
any policy anymore.

To prevent the whole module from loading we need to add “selinux=0” to the kernel parameters during boot
time or execute this command and reboot the system:

$ sudo grubby --update-kernel ALL --args selinux=0

Reply

01101001b
October 9, 2019 at 12:31 pm
left: 549px; top: 32px;height: 15px;width: 60px;
ssssss 25 Male

No
This article proved quite useful to me. Thank you!
Rs 740
https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ 8/14
10/9/21, 5:53 AM How to Disable SELinux Temporarily or Permanently

Reply

Mik
August 22, 2019 at 7:19 am

Only me have that file in /etc/selinux/ instead?

Reply

James Stone
July 26, 2019 at 5:02 pm

The only thing you left out is why. Why would you do this?

Reply

Aaron Kili
July 29, 2019 at 10:48 am

@James

This paragraph states the why bit: “When you install RHEL/CentOS or several derivatives, the SELinux
feature or service is enabled by default, due to this, some applications on your system may not actually
support this security mechanism. Therefore, to make such applications function normally, you have to
disable or turn off SELinux.”

Reply

Got something to say? Join the discussion.


Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all
comments are moderated and your email address will NOT be published.
left: 549px; top: 32px;height: 15px;width: 60px;
ssssss 25 Male

No

Rs 740
https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ 9/14
10/9/21, 5:53 AM How to Disable SELinux Temporarily or Permanently

Name *

Email *

Website

Save my name, email, and website in this browser for the next time I comment.

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Post Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Over 3,500,000+ Readers

left: 549px; top: 32px;height: 15px;width: 60px;


ssssss 25 Male

No

Rs 740
https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ 10/14
10/9/21, 5:53 AM How to Disable SELinux Temporarily or Permanently

A Beginners Guide To Learn Linux for Free [with Examples]

left: 549px; top: 32px;height: 15px;width: 60px;


ssssss 25 Male

No

Rs 740
https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ 11/14
10/9/21, 5:53 AM How to Disable SELinux Temporarily or Permanently

Red Hat RHCSA/RHCE 8 Certification Study Guide [eBooks]

Linux Foundation LFCS and LFCE Certification Study Guide [eBooks]

left: 549px; top: 32px;height: 15px;width: 60px;


ssssss 25 Male

No

Rs 740
https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ 12/14
10/9/21, 5:53 AM How to Disable SELinux Temporarily or Permanently

Learn Linux Commands and Tools

10 fdisk Commands to Manage Linux Disk Partitions

Gdu – A Pretty Fast Disk Usage Analyzer for Linux

Fun in Linux Terminal – Play with Word and Character Counts

How to Delete User Accounts with Home Directory in Linux

Bat – A Cat Clone with Syntax Highlighting and Git Integration

How to List Files Installed From a RPM or DEB Package in Linux

left: 549px; top: 32px;height: 15px;width: 60px;


ssssss 25 Male

No

Rs 740
https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ 13/14
10/9/21, 5:53 AM How to Disable SELinux Temporarily or Permanently

If You Appreciate What We Do Here On TecMint, You Should Consider:

Linux Server Monitoring Tools

Conky – The Ultimate X Based System Monitor Application

MTR – A Network Diagnostic Tool for Linux

Understand Linux Load Averages and Monitor Performance of Linux

How to Install Cacti with Cacti-Spine in Debian and Ubuntu

How to Add Linux Host to Nagios Monitoring Server Using NRPE Plugin

left: 549px;
How to Install Zabbixtop:on
32px;height:
Debian 10 15px;width: 60px;
ssssss 25 Male

No

Rs 740
https://www.tecmint.com/disable-selinux-in-centos-rhel-fedora/ 14/14

You might also like