Selinux是Redhat/CentOS系统特有的安全机制。所以装完系统,我们一般都要把selinux关闭,以免引起不必要的麻烦。关闭selinux的方法为,使 “SELINUX=disabled”, 默认为 enforcing
[root@localhost ~]# vim /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
保存该配置文件后,重启机器方可生效,临时关闭selinux的命令为:
[root@localhost ~]# setenforce 0
我们可以使用 getenforce 命令获得当前selinux的状态:
[root@localhost ~]# getenforce
Disabled
阿铭的selinux早就关闭了,默认会输出 “enforcing” , 当使用 setenforce 0 这个命令后,再 getenforce 会输出 “permissive”