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


相关推荐

  • 智能点餐系统开发纪实1—–java服务器搭建,android客户端实现通信

    今天开始做的,由于是根据以前的一个小项目改的,不是从头做的,所以没法把所有代码共享,就在这里记录一下每天的思路,希望能给需要的同学抛砖引玉。思路其实就是上一篇博客的内容,完善了一下代码,实现了从android发送一句话给服务器,然后服务器把这句话再发回来。能够实现这样的正常通信,后面的工作应该不会太难。下面开始贴些主要的代码。首先是服务器端,用了两个类,一个MyServer,处理and

    2022年3月11日
    49
  • 在 Windows10 系统下安装 Ubuntu22.04 系统

    在 Windows10 系统下安装 Ubuntu22.04 系统在Windows10系统下安装Ubuntu22.04系统

    2022年10月9日
    0
  • 什么是bs模型_cs模型人物看不见

    什么是bs模型_cs模型人物看不见C/S结构,即Client/Server(客户机/服务器)结构,是大家熟知的软件系统体系结构,通过将任务合理分配到Client端和Server端,降低了系统的通讯开销,可以充分利用两端硬件环境的优势。早期的软件系统多以此作为首选设计标准。(用的是ip,tcp/udp通信协议)B/S结构,即Browser/Server(浏览器/服务器)结构,是随着Internet技术的兴起,对C/S结构的一种…

    2022年9月17日
    0
  • VC编程实现色彩空间XYZ与LAB相互转换[通俗易懂]

    VC编程实现色彩空间XYZ与LAB相互转换[通俗易懂]VC编程实现色彩空间XYZ与LAB相互转换文章VC编程实现色彩空间RGB与XYZ相互转换已经介绍了RGB与XYZ色彩空间的转换算法以及实际的VC源代码,在上一篇文章已经提到,在PhotoShop中经常使用有RGB(红色、绿色、蓝色)、CMYK(青色、洋红、黄色、黑色)、HSB(色相、饱和度、亮度)和Lab4中色彩空间。我们用到XYZ色彩空间的目的是进行RGB与LAB色彩空

    2022年6月19日
    39
  • react中添加debounce 实现[通俗易懂]

    react中添加debounce 实现[通俗易懂]react中添加debounce实现handelChange(e){//输入框修改的时候执行的方法 e.persist()//react默认会清楚所有的默认属性,所以需要添加这段,保留参数的属性 debounce(()=>{ console.log(e) },500)() }<inputref={ev=>this.moneyInp…

    2022年6月20日
    73
  • 三层架构(我的理解及具体分析)

    三层架构(我的理解及具体分析)

    2021年11月23日
    35

发表回复

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

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