CentOS8怎么禁用SELinux
本文小编为大家详细介绍“CentOS8怎么禁用SELinux”,内容详细,步骤清晰,细节处理妥当,希望这篇“CentOS8怎么禁用SELinux”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。
SELINUX全称为Security Enhanced Linux (安全强化 Linux),是对系统安全级别更细粒度的设置。 由于SELinux配置设置太严格,可能会与CM需要的功能相冲突,所以这里我们选择直接关掉。
在开始在CentOS 8上禁用SELinux之前,请务必先检查SELinux的状态。
为此,请运行以下命令:
[root@localhostwww.linuxidc.com]#sestatusSELinuxstatus:enabledSELinuxfsmount:/sys/fs/selinuxSELinuxrootdirectory:/etc/selinuxLoadedpolicyname:targetedCurrentmode:enforcingModefromconfigfile:enforcingPolicyMLSstatus:enabledPolicydeny_unknownstatus:allowedMemoryprotectionchecking:actual(secure)Maxkernelpolicyversion:31
这表明SELinux已启动并正在运行。
要暂时禁用SELinux,请运行命令。
#setenforce0
另外,您可以运行命令。
#setenforcePermissive
这些命令中的任何一个都将暂时禁用SELinux,直到下次重启为止。
如何在CentOS 8上永久禁用SELinux现在,让我们看看如何永久禁用SELinux。 SElinux的配置文件位于 /etc/selinux/config。 因此,我们需要对该文件进行一些修改。
#vi/etc/selinux/config
将SELinux属性设置为Disabled,如下所示:
#ThisfilecontrolsthestateofSELinuxonthesystem.#SELINUX=cantakeoneofthesethreevalues:#enforcing-SELinuxsecuritypolicyisenforced.#permissive-SELinuxprintswarningsinsteadofenforcing.#disabled-NoSELinuxpolicyisloaded.SELINUX=disabled#SELINUXTYPE=cantakeoneofthesethreevalues:#targeted-Targetedprocessesareprotected,#minimum-Modificationoftargetedpolicy.Onlyselectedprocessesareprotected.#mls-MultiLevelSecurityprotection.SELINUXTYPE=targeted
保存并退出配置文件,然后使用以下任何命令重新启动CentOS 8 Linux系统。
#reboot#init0#telinit0
现在,使用命令检查SELinux的状态。
[linuxidc@localhostwww.linuxidc.com]$sestatusSELinuxstatus:disabled
SELinux是CentOS 8上非常关键的功能,有助于限制未经授权的用户访问系统上的某些服务。
读到这里,这篇“CentOS8怎么禁用SELinux”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注亿速云行业资讯频道。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。