Advance

How to disable SELinux temporarily or permanently

How to disable SELinux temporarily or permanently

A Linux system administrator needs to know some Linux tricks. In this article, you are going to learn how to disable SELinux temporarily or permanently. Linux, as the most secure operating system you can use for its illustrious security implementation features. Join us to check the status of SELinux and also disable SELinux in CentOS/RHEL and Fedora, in case it is enabled.

 

 

How to disable SELinux temporarily or permanently

SELinux is described as MAC (mandatory access control) security structure executed in the kernel for starters. SELinux offers some security policies which would otherwise not be effectively implemented by a System Administrator.

While installing the RHEL/CentOS, or its derivatives, the SELinux feature or service will be enabled by default, so some applications on your system may not actually support this security mechanism. Therefore, you have to disable or turn off SELinux to make such applications function normally.

Please note: pay attention to this tutorial to implement some mandatory access control on files and services to function properly, If you don’t want to disable SELinux.

Recommended Article: How to disable SELinux temporarily or permanently

Do not miss

Tutorial Install Python 3 on RHEL 8 / CentOS 8

How to disable SELinux in Linux

First, check the status of SELinux on your system, by running the following command:

sestatus  selinux config file view

Depending on what you want to achieve, you can do this temporarily or permanently after proceed to disable SELinux on your system.

Buy Linux Virtual Private Server

Disable SELinux temporarily

Run the below command to disable SELinux temporarily.

echo 0 > /selinux/enforce

Also, you can use the setenforce tool alternatively.

setenforce 0

Or, instead of 0, you can use the Permissive option.

setenforce Permissive

Note: the methods you read till here, would work until the next reboot, therefore to disable SELinux permanently, move to the next section.

 

Disable SELinux permanently

You need to open the file /etc/sysconfig/selinux , to disable SELinux permanently.

vi /etc/sysconfig/selinux

disable selinux

Now, you should change the directive SELinux=enforcing to SELinux=disabled.

SELINUX=disabled    selinux config file for disable selinux

Next, save and exit the file to let the changes take effect. To do this, reboot your system or check the status of SELinux using sestatus command.

sestatus  after disabled selinux

 

In conclusion,

You learned how to disable SELinux on CentOS/RHEL and Fedora. 

 

Dear user, we hope you would enjoy this tutorial, you can ask questions about this training in the comments section, or to solve other problems in the field of Eldernode training, refer to the Ask page section and raise your problems in it.

We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave Your Comment

Your email address will not be published.

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+18054214518

7 days a week, 24 hours a day