Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to disable SELinux temporarily or permanently

Shulou Source: shulou.com Published: 2022-06-01 06:19:00 10月03日 Update

This article mainly shows you "how to temporarily or permanently disable SELinux", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to temporarily or permanently disable SELinux" this article.

1. Preface

How to disable SELinux temporarily or permanently.

Linux is considered to be one of the most secure operating systems today because of its outstanding security features such as SELinux (Security enhanced Linux).

For beginners, SELinux is described as a mandatory access control (MAC) security structure executed in the kernel. SELinux provides a way to enforce certain security policies, otherwise the system administrator will not be able to implement them effectively.

When you install RHEL/CentOS or other derivatives, SELinux services are enabled by default, so some applications on your system may not support this security mechanism. Therefore, for such applications to work properly, SELinux must be disabled or turned off.

Important: if you do not want to disable SELinux, you should read the following to implement mandatory access control for files and services to make them work properly.

In this tutorial, we will walk you through the steps to check the status of SELinux and disable SELinux in CentOS or RHEL or Fedora.

The first thing to do is to check the status of SELinux on the system, which can be done by running the following command:

Sestatus

Next, disable SELinux on the system, which can be temporary or permanent, depending on what you want to achieve.

two。 How to disable SELinux temporarily

To temporarily disable SELinux, execute the following command as the root user:

Echo 0 > / selinux/enforce

Alternatively, you can use the setenforce tool, as follows:

Setenforce 0

Otherwise, use the Permissive option instead of 0, as follows:

Setenforce Permissive

The above method only works until the next reboot, so disable SELinux permanently and move on.

3. How to permanently disable SELinux

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

Vi / etc/sysconfig/selinux

Then change the configuration SELinux=enforcing to SELinux=disabled, as shown in the following figure.

SELINUX=disabled

Then, save and exit the file, restart the system for the configuration to take effect, and then use the sestatus command to check the status of the SELinux, as follows:

Sestatus above is all the contents of the article "how to disable SELinux temporarily or permanently". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Permanent security system content commands files status articles force check run valid tools applications methods programs policies learning help application Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Huawei Shulou Information OPPO Reno macOS