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


相关推荐

  • rfq用户level2报价是几条(什么是建立在海量数据挖掘基础上)

    海量数据挖掘MiningMassiveDatasets(MMDs)-JureLeskovec courses学习笔记计算广告ComputationalAdvertising{博客内容:ComputationalAdvertising. Theproblemistoselectadstoshowwithotherinformation,typical

    2022年4月15日
    58
  • python2+selenium爬取笔趣读小说

    python2+selenium爬取笔趣读小说python2+selenium爬取笔趣读小说 #!/usr/bin/envpython#coding=utf-8fromseleniumimportwebdriverimporttimefrombs4importBeaut…

    2025年8月19日
    3
  • malloc函数用法

    malloc函数用法1、函数声明void*malloc(intsize);说明:malloc向系统申请分配size字节的内存空间,返回类型为void*类型。2、使用int*p;p=(int*)malloc(sizeof(int));注意:(1)因为malloc返回的是不确定类型的指针,所以返回之前必须经过类型强制转换,否则编译报错,如:“不能将void*赋值给int*变量

    2022年6月10日
    75
  • 京东云免费SLL正式(HTTPS)免费申请及nginx配置

    京东云免费SLL正式(HTTPS)免费申请及nginx配置京东云免费ssl证书申请及配置一、证书申请1、京东云地址:[https://www.jdcloud.com/](https://www.jdcloud.com/)2、登录京东云后可在左上角云服务中搜索:SSL3、选择搜索出的选项中的SSL数字证书,进入SSL证书管理平台;4、在左侧选择申购管理,然后点击申购证书5、在申购SSL证书界面,按下图选择对应的证书类型,即可购买;6、订单确认,立即支付即可完成证书的申请二、证书配置1、完善域名信息1、在申购管理中,找到刚才购买的证书,点击完善信息;2、在下面的输入

    2022年10月14日
    3
  • ThinkPHP中实现微信支付(jsapi支付)流程

    ThinkPHP中实现微信支付(jsapi支付)流程

    2021年10月30日
    40
  • 目录爆破工具_dir是什么意思中文

    目录爆破工具_dir是什么意思中文在github中下下来网址:https://github.com/maurosoria/dirsearch下载下来我是用的kail所以我把它也放在kail里面了dirsearch需要python3,kail中是自带的进入dirsearch目录后执行./dirsearch.py-u10.0.3.45-ephp-u指定url-…

    2022年10月5日
    4

发表回复

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

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