临时关闭
[root@192_168_31_100 ~]# setenforce
usage: setenforce [ Enforcing | Permissive | 1 | 0 ]getenforce #查看当前SELinux开关状态setenforce Enforcing #打开
setenforce 1 #打开setenforce Permissive #关闭
setenforce 0 #关闭
永久关闭
[root@10-255-20-218 ~]# cat /etc/sysconfig/selinux # 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=disabled
# 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
也可以通过sed命令快速修改
sed -i 's#^SELINUX=.*#SELINUX=disabled#g' /etc/selinux/config
参考链接
https://www.thegeekdiary.com/centos-redhat-how-to-set-selinux-modes/