如何在CentOS,RHEL,Fedora中临时或永久禁用SELinux

SELinux is very powerful security mechanism for Linux distributions. Distributions like CentOS, RHEL or Fedora comes SELinux enabled by default. In some situations we do not need SELinux protection especially in end user systems. In this tutorial we will look how to disable SELinux temporarily or Permanently.

SELinux是Linux发行版非常强大的安全机制。 像CentOS,RHEL或Fedora这样的发行版默认都启用了SELinux。 在某些情况下,我们不需要SELinux保护,尤其是在最终用户系统中。 在本教程中,我们将研究如何临时或永久禁用SELinux。

列出SELinux状态 (List SELinux Status)

First step is getting information about SELinux status. We can get and list SELinux status with the sestatus command.

第一步是获取有关SELinux状态的信息。 我们可以使用sestatus命令获取并列出SELinux状态。

$ sestatus
List SELinux Status
List SELinux Status
列出SELinux状态

We can see from first line of output that the SELinux status is enabled

从输出的第一行可以看到SELinux statusenabled

暂时禁用SELinux (Disable SELinux Temporarily)

There is different ways to disable SELinux. Disabling SELinux temporarily work only for current run. After the system is rebooted SELinux configuration will revert to the persistent one and the SELinux will be enabled. We can disable with the following ways. All of them requires root privileges.

有多种禁用SELinux的方法。 暂时禁用SELinux仅适用于当前运行。 重启系统后,SELinux配置将恢复为永久配置,并启用SELinux。 我们可以通过以下方式禁用。 所有这些都需要root特权。

$ echo 0 > /selinux/enforce

OR

要么

$ setenforce 0

OR

要么

$ setenforce Permissive

永久禁用SELinux (Disable SELinux Permanently)

The best way to get rid of from SELinux is disabling it permanently. We should save configuration. This will make configuration effective between reboots. We have  different ways to accomplish this. All of them requires root privileges.

摆脱SELinux的最好方法是永久禁用它。 我们应该保存配置。 这将使配置在重新启动之间有效。 我们有不同的方法来实现这一目标。 所有这些都需要root特权。

Change SELINUX=enforcing line in /etc/sysconfig/selinux to the following.

SELINUX=enforcing /etc/sysconfig/selinux中的SELINUX=enforcing行更改为以下内容。

SELINUX=disabled
Disable SELinux Permanently
Disable SELinux Permanently
永久禁用SELinux
LEARN MORE  mkdir Command Options For Linux and Windows
了解更多用于Linux和Windows的mkdir命令选项

翻译自: https://www.poftut.com/disable-selinux-temporarily-permanently-centos-rhel-fedora/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值