CentOS7中关闭selinux
2016-05-06 10:56
656 查看
在安装Cobbler和Puppet时需要关闭selinux,但是通常情况下载安装完CentOS7后,默认情况下SElinux是启用状态,
如下所示:
[csharp] view plaincopy
[root@rdo ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28
1、如果要临时关闭,可以执行
[cpp] view plaincopy
setenforce 0
此时的状态如下
[html] view plaincopy
[root@rdo ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28
2、如果要永久关闭,可以修改配置文件/etc/selinux/config,将SELINU置为disabled。
[html] view plaincopy
[root@rdo ~]# cat /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
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
修改该配置文件也可以执行下面的命令来完成
[html] view plaincopy
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
修改完成后,保存重启,重启后状态如下:
[html] view plaincopy
[root@rdo ~]# sestatus
SELinux status: disabled
如下所示:
[csharp] view plaincopy
[root@rdo ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28
1、如果要临时关闭,可以执行
[cpp] view plaincopy
setenforce 0
此时的状态如下
[html] view plaincopy
[root@rdo ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28
2、如果要永久关闭,可以修改配置文件/etc/selinux/config,将SELINU置为disabled。
[html] view plaincopy
[root@rdo ~]# cat /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
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
修改该配置文件也可以执行下面的命令来完成
[html] view plaincopy
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
修改完成后,保存重启,重启后状态如下:
[html] view plaincopy
[root@rdo ~]# sestatus
SELinux status: disabled
相关文章推荐
- 【Linux程序员福音】在Visual Studio上用C++写Linux
- Linux进程的睡眠和唤醒
- 解决vmware上linux虚拟机的eth0不存在的问题
- Linux 文件描述符
- linux 文件归档
- Linux-37-linux常用快捷键总结(L005-19)
- Linux-36-linux基础重要命令13(L005-18)
- Linux进程管理之“四大名捕”
- 关于linux用户权限的一些管理
- centos6.5/6.3升级安装ImageMagick7.0.1-1
- Linux-35-liunx基础重要命令12(L005-17)
- centos6.3下安装中文输入法
- Linux 安装lxml及各种问题的解决
- Linux防火墙的关闭和开启
- linux xargs命令及find命令
- centos 7访问windows共享文件夹
- CentOS 6.5下yum安装 MySQL-5.5全过程图文教程
- Linux-34-linux基础重要命令11(L005-16)
- CentOS6.5上安装Python2.7和PIP
- linux cat命令详解