计算机系统应用教程网站

网站首页 > 技术文章 正文

如何关闭SELinux? 如何关闭selinux的权限

btikc 2024-12-25 10:34:34 技术文章 34 ℃ 0 评论

什么是SELinux

SELinux的全称是Security-Enhanced Linux,意为安全增强型Linux[what]。它就像是安全管家软件中的“沙箱”,实际上是美国国家安全局对于强制访问控制的实现。[赞]

在实际生产环境中,一般都是关闭的。[哈欠]原因是如果开启可能会出现莫名其妙的现象。你以为正常应该是这样,检查配置也没问题,但就是不行[鄙视],其实原因就在SELinux的开启,因此建议关闭[偷笑],并不影响系统的安全性。

临时关闭SELinux

[root@brother ~]# getenforce 
Enforcing
[root@brother ~]# setenforce 0
[root@brother ~]# 
[root@brother ~]# getenforce
Permissive

命令getenforce可以查看SELinux是否开启,显示为Enforcing表示开启状态。

命令setenforce可以关闭或开启SELinux,参数为0表示关闭,参数为1表示开启。

但是,以上操作属于临时生效。当系统重新载入配置或者重启后,就会失效。

永久关闭SELinux

修改配置文件“/etc/selinux/config”中的“SELINUX=enforcing”,改成“SELINUX=disabled”。

[root@brother ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
修改第七行  SELINUX=enforcing  =>  SELINUX=disabled

重启计算机,永久配置生效。

[root@brother ~]# reboot

推荐阅读

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表