查看selinux配置文件linux
[root@localhost ~]# cat /etc/selinux/configide
# This file controls the state of SELinux on the system.spa
# SELINUX= can take one of these three values:three
# enforcing - SELinux security policy is enforced.ci
# permissive - SELinux prints warnings instead of enforcing.get
# disabled - No SELinux policy is loaded.it
SELINUX=enforcingio
# SELINUXTYPE= can take one of these two values:class
# targeted - Targeted processes are protected,sed
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
修改selinux爲關閉狀態
方法一
[root@localhost ~]# vi /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=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
在vi下按「i」進行編輯,講enforcing改成disabled
按「esc」退出編輯模式,「:wq 」 保存退出
檢查:cat /etc/selinux/config
方法二
設置:sed -i s#SELINUX=enforcing#SElINUX=disabled#g /etc/selinux/config
檢查:grep "disable" /etc/selinux/config
以上永久關閉selinux,重啓生效
查看selinux狀態:
[root@localhost ~]# getenforce
Enforcing
臨時關閉
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
即時生效