fedora和centos_如何在Fedora和CentOS Linux中控制或禁用SELinux

fedora和centos

For most of cases, you should not disable SELinux. However, for some users, SELinux may cause problems or is not needed. We may just make it not block operations or totally disable it.

在大多数情况下,您不应禁用SELinux 。 但是,对于某些用户,SELinux可能会引起问题或不需要。 我们可能只是使其不阻止操作或完全禁用它。

发出SELinux日志警告而不是阻止 (Making SELinux log warnings instead of blocking )

For many cases, people find SELinux blocks operations. For tests or some other situations, you may make it not blocking. But the warning messages of SELinux tells you many possible security problems. An good way may be making it warn you but not block operations.

在许多情况下,人们会发现SELinux阻止了操作。 对于测试或其他情况,您可以使其不阻塞。 但是SELinux的警告消息告诉您许多可能的安全问题。 一个好的方法可能是警告您但不阻止操作。

SELinux’s configuration file is /etc/selinux/config

SELinux的配置文件是/ etc / selinux / config

The method to configuring SELinux in Fedora is by editing the config file of SELinux:

Fedora中配置SELinux的方法是编辑SELinux的配置文件:

$ cd /etc/selinux/
$ su
# cp config config.bak0
# vi config

Find this line:

找到这一行:

SELINUX=enforcing

Change it to:

更改为:

SELINUX=permissive

You will need to reboot to make it take effect.

您将需要重新启动才能生效。

暂时禁用SELinux (Temporarily disable SELinux )

Instead of permanently disable SELinux, you may just want to disable SELinux temporaryly. You can do this by running

您可能只想暂时禁用SELinux,而不是永久禁用SELinux。 您可以通过运行

# setenforce 0

As an alternative way, if you have SELinux enalbed

作为替代方法,如果您拥有SELinux,

# echo 0 >/selinux/enforce

You can also enable SELinux back by

您还可以通过以下方式启用SELinux

# setenforce 1

or

要么

# echo 1 >/selinux/enforce

永久禁用SELinux (Permanently disable SELinux )

If you would not to see SELinux forever, you may disable it permanently.

如果您不会永远看到SELinux,则可以永久禁用它。

The method to diable SELinux in Fedora:

在Fedora中禁用SELinux的方法:

$ cd /etc/selinux/
$ su
# cp config config.bak0
# vi config

Find this line:

找到这一行:

SELINUX=enforcing

Change it to:

更改为:

SELINUX=disabled

检查SELinux状态 (Checking SELinux status )

After configuring SELinux, you may want to check the status of SELinux. Here are several ways.

配置SELinux之后,您可能要检查SELinux的状态。 这里有几种方法。

$ selinuxenabled
$ echo $?
1

Here, the return value of selinuxenabled indicates its status: ‘1’ means disabled and ‘0’ means enabled. This is very useful for scripts.

在这里, selinuxenabled的返回值指示其状态:“ 1”表示禁用,“ 0”表示启用。 这对于脚本非常有用。

$ sestatus
SELinux status:                 disabled

sestatus shows human friendly results showing the status.

sestatus显示出人类友好的状态,并显示了状态。

$ getenforce 
Disabled

getenforce is like sestatus but shows only the status with a word.

getenforce就像sestatus但只显示一个单词的状态。

Update on Apr. 29, 2015: add more options for controlling and disabling SELinux.

2015年4月29日更新 :添加了更多用于控制和禁用SELinux的选项。

翻译自: https://www.systutorials.com/disable-selinux-in-fedora/

fedora和centos

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值