如何查看,关闭和开启selinux

简介:
以下介绍一下SELinux相关的工具
/usr/bin/setenforce 修改SELinux的实时运行模式
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式
如果要彻底禁用SELinux 需要在/etc/sysconfig/selinux中设置参数selinux=0
,或者在/etc/grub.conf中添加这个参数
/usr/bin/setstatus -v
察看系统的状态
以下是运行输出,请参考
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Policy version: 18

不重启关闭selinux的解决办法:
执行命令:setenforce 0
在新版本中的Red Hat 和 Fedora 上,修改档案/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 - SELinux is fully disabled.
SELINUX=enforcing

# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted

把 SELINUX设定为disable, 下次启动系统后将会停止SElinux。
Linux核心参数(Kernel Parameter)

或者可以在核心参数后加上: selinux=0 (停止) 或 selinux=1 (开启)参数

档案/boot/grub/menu.lst

title Fedora Core (2.6.18-1.2798.fc6)
root (hd0,0)
kernel /vmlinuz-2.6.18-1.2798.fc6 ro root=LABEL=/ rhgb quiet selinux=0
initrd /initrd-2.6.18-1.2798.fc6.img

检查SELinux现时况态

要知到你现在是否使用 SELinux:

# getenforce

disabled



本文转自茄子_2008博客园博客,原文链接:http://www.cnblogs.com/xd502djj/p/5308887.html,如需转载请自行联系原作者。


目录
相关文章
|
Ubuntu 网络协议 网络安全
ubuntu防火墙的安装,开启,关闭和添加规则等操作
ubuntu防火墙的安装,开启,关闭和添加规则等操作
5290 0
ubuntu防火墙的安装,开启,关闭和添加规则等操作
|
5月前
|
Linux Android开发
代码里永久关闭selinux
代码里永久关闭selinux
86 0
|
5月前
|
网络协议 Linux 网络安全
linux服务器防火墙的开启及关闭
linux服务器防火墙的开启及关闭
789 1
|
11月前
|
Ubuntu Linux 网络安全
linux开启和关闭防火墙
linux开启和关闭防火墙
255 1
|
Linux
18.13 SELinux策略规则的开启和关闭
默认情况下,并不是所有的规则都处于开启状态,因此,虽然我们无需修改规则的具体内容,但学习如何开启和关闭规则,还是很有必要的。
239 0
18.13 SELinux策略规则的开启和关闭
|
网络协议 Linux 网络安全
CentOS7在防火墙开启与关闭以及端口操作
CentOS7在防火墙开启与关闭以及端口操作
403 0
CentOS7在防火墙开启与关闭以及端口操作
|
Linux 网络安全 Windows
如何开启/关闭服务器防火墙
本文介绍了部分开启/关闭Windows和Linux系统防火墙的方法。
4122 0
如何开启/关闭服务器防火墙
SELinux 开启和关闭
查看SELinux状态: 1、/usr/sbin/sestatus -v      ##如果SELinux status参数为enabled即为开启状态 SELinux status:                 enabled 2、getenforce                 ##也可以用这个命令检查 关闭SELinux: 1、临时关闭(不用重启机器): sete
1526 0