了解如何关闭selinux[通俗易懂]

了解如何关闭selinux[通俗易懂]1.查看SELinux状态1.1getenforcegetenforce命令是单词get(获取)和enforce(执行)连写,可查看selinux状态,与setenforce命令相反。setenforce命令则是单词set(设置)和enforce(执行)连写,用于设置selinux防火墙状态,如:setenforce0用于关闭selinux防火墙,但重启后失效[roo…

大家好,又见面了,我是你们的朋友全栈君。

1.查看SELinux状态
1.1 getenforce
getenforce 命令是单词get(获取)和enforce(执行)连写,可查看selinux状态,与setenforce命令相反。
setenforce 命令则是单词set(设置)和enforce(执行)连写,用于设置selinux防火墙状态,如: setenforce 0用于关闭selinux防火墙,但重启后失效

[root@localhost ~]# getenforce
Enforcing

1.2 /usr/sbin/sestatus
Current mode表示当前selinux防火墙的安全策略

[root@localhost ~]# /usr/sbin/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

SELinux status:selinux防火墙的状态,enabled表示启用selinux防火墙
Current mode: selinux防火墙当前的安全策略,enforcing 表示强

2.关闭SELinux
2.1 临时关闭
setenforce 0 :用于关闭selinux防火墙,但重启后失效。

[root@localhost ~]# setenforce 0
[root@localhost ~]# /usr/sbin/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.1 永久关闭
修改selinux的配置文件,重启后生效。

打开 selinux 配置文件

[root@localhost ~]# vim /etc/selinux/config

修改 selinux 配置文件
将SELINUX=enforcing改为SELINUX=disabled,保存后退出

# 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 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

此时获取当前selinux防火墙的安全策略仍为Enforcing,配置文件并未生效。

[root@localhost ~]# getenforce
Enforcing

重启

[root@localhost ~]# reboot

验证

[root@localhost ~]# /usr/sbin/sestatus
SELinux status:                 disabled

[root@localhost ~]# getenforce
Disabled
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/153560.html原文链接:https://javaforall.net

赞 (0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Unity3D开发资料

    Unity3D开发资料分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!               前言(一定要看)首先说

    2022年7月16日
  • 集成学习-Voting

    集成学习-Voting一、什么是集成学习集成学习是使用一系列学习器进行学习,并使用某种规则把各个学习结果进行整合从而获得比单个学习器更好的学习效果的一种机器学习方法。一般情况下,集成学习中的多个学习器都是同质的”弱学习器”。上面的描述来自百度百科,看定义的话知道是基于‘弱学习器’的,很多讲集成学习的教程都会先讲决策树,然后讲到随机森林和GBDT,也就是bagging和boosting,…

    2022年10月31日
  • Ubuntu中的dpkg命令「建议收藏」

    Ubuntu中的dpkg命令「建议收藏」Linux命令学习系列之dpkg命令详解   普通dpkg用法   dpkg-i安装一个Debian包裹文件,如你手动下载的文件。   dpkg-c列出的内容。   dpkg-I从中提取包裹信息。   dpkg-r移除一个已安装的包裹。   dpkg-L列出安装的所有文件清单。同时请看dpkg-c来检查一个.deb文件的

    2022年5月22日
  • 2021年程序人生的随想总结

    时光不负追梦人,愿你我不负韶华,前程似锦~~

    2022年3月1日
  • python中 列表(List)转换为字符串(Str)的方法

    python中 列表(List)转换为字符串(Str)的方法1、List列表转为Str字符串List中存的是字符串的时候,一般是通过.join()函数去转换:例:dataList=[‘1′,’2′,’3′,’4’]str1=“,”+join(dataList)print(dataList)…

    2022年6月2日
  • POJ 3009-Curling 2.0(DFS)

    POJ 3009-Curling 2.0(DFS)

    2022年1月11日

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号