了解如何关闭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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 后台 管理 系统

    后台 管理 系统课程/视频管理系统:https://item.taobao.com/item.htm?spm=a2oq0.12575281.0.0.50111deb1nO3pa&ft=t&id=643539140484教务管理系统:https://item.taobao.com/item.htm?spm=a2oq0.12575281.0.0.50111deb1nO3pa&ft=t&id=643539140484成绩管理系统:https://item.taobao.com/item.h

    2022年4月25日
    43
  • MessageDigest简要

    MessageDigest简要本文博客原參考文章:http://blog.sina.com.cn/s/blog_4f36423201000c1e.html一、概述java.security.MessageDigest类用于为应用程序提供信息摘要算法的功能,如MD5或SHA算法。简单点说就是用于生成散列码。信息摘要是安全的单向哈希函数,它接收随意大小的数据。输出固定长度的哈希值。关…

    2022年6月29日
    26
  • 数据结构实验哈夫曼编码算法的实现_哈夫曼编码算法的实现

    数据结构实验哈夫曼编码算法的实现_哈夫曼编码算法的实现一、什么是赫夫曼编码哈夫曼编码(HuffmanCoding),又称霍夫曼编码,是一种编码方式,可变字长编码(VLC)的一种。Huffman于1952年提出一种编码方法,该方法完全依据字符出现概率来

    2022年8月16日
    8
  • 亲测解决 :Navigation cancelled from “xxx“ to “xxx“ with a new navigation

    亲测解决 :Navigation cancelled from “xxx“ to “xxx“ with a new navigation使用vue3.0写了一个登入页面,再点击登入的时候,第一次点击会没有反应,F12查看接口都调用了但是没有跳转,控制台打印出错:错误说有异常没有捕获;这个错误是vue-router内部的错误,没有进行catch处理导致的;再vue-router3.0以上的版本新增功能:push和replace方法会返回一个promise;解决方案:在vue的router的js中添加下面代码constoriginalPush=VueRouter.prototype.pushconstorigin

    2022年7月26日
    12
  • 分布式Session共享解决方案「建议收藏」

    Session是服务器用来保存用户操作的一系列会话信息,由Web容器进行管理。单机情况下,不存在Session共享的情况,分布式情况下,如果不进行Session共享会出现请求落到不同机器要重复登录的情况,一般来说解决Session共享有以下几种方案。1、session复制session复制是早期的企业级的使用比较多的一种服务器集群session管理机制。应用服务器开启web容器的sessi…

    2022年4月4日
    39
  • linux修改文件没有权限设置,Linux下修改文件权限(所有权)

    linux修改文件没有权限设置,Linux下修改文件权限(所有权)Linux与Unix是多用户操作系统,所以文件的权限与所有权的实现就显得很有必要;每个文件主要与三组权限打交道,分别是用户(user),用户组(group),其他用户(other)用户(u)是文件的所有者,通常有所有的文件的操作权限用户组(g)是多个用户的集合,可能有文件的部分访问权,相当于各用户之间的共享文件其他(o)是指文件所有者和用户组成员之外的任何人使用ls-l可以显示出当前目录下的文件…

    2025年10月31日
    5

发表回复

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

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