关闭selinux
1、查看SELinux状态:getenforce
Enforcing(启动)
disable(禁用)
1、禁用SELinux(重启后依然生效)
修改 vi /etc/sysconfig/selinux
[root@developer ~]# 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=enforcing
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
更改其中的SELINUX项的值就可以关闭和启用SELinux服务了。
修改成 SELINUX=disable 禁用SeLinux
修改成 SELINUX=enforcing 使用SeLinux
或
vi /etc/selinux/conf
set SELINUX=disabled
2、不重启让其生效
/usr/sbin/setenforce 0 立刻关闭 SELINUX
/usr/sbin/setenforce 1 立刻启用 SELINUX
3,加到系统默认启动里面
echo "/usr/sbin/setenforce 0" >> /etc/rc.local
echo "/usr/sbin/setenforce 0" >> /etc/rc.local