关闭selinux的方法有两种:临时关闭和永久关闭。

查看selinux的状态:estatus

[root@162-219-29-3 ~]# 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:          disabled
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      31

1. 临时关闭:

临时关闭在重启后会失效。

临时关闭命令:

setenforce 0

查看是否关闭成功:

getenforce

临时关闭报错 setenforce:  setenforce() failed    ,问题是权限不够,我们需要管理员权限才可以。

[centos@ip123 ~]$ setenforce 0
setenforce:  setenforce() failed

解决办法在root下执行:

su  - root
setenforce  0

2. 永久关闭:

编辑配置文件 /etc/selinux/config 。需要重启才可以生效

sed -i '/^SELINUX=/s/enforcing/disabled/' /etc/selinux/config

我们常用的方法是,先配置临时生效,再更改配置文件。这样就算服务器重启了,selinux也还是关闭的。

转载于:https://www.cnblogs.com/operationhome/p/9794109.html

centos 关闭selinux 临时关闭selinux 报错 setenforce: setenforce() failed相关推荐

  1. CentOS 7安装Development Tools 失败 报错 group tools does not exist. Maybe run: yum groups mark install

    重装centos,以及迁移时,碰见这个问题.如下图: CentOS 7安装Development Tools 失败 报错 group tools does not exist. Maybe run: ...

  2. 报错curl: (7) Failed to connect to 127.0.0.1 port xxxx: Connection refused

    (pyenv install xxx) 报错curl: (7) Failed to connect to 127.0.0.1 port xxxx: Connection refused的解决方法 问题 ...

  3. 解决只读模式U盘保护格式化或者dd写报错:ERROR: failed to open ‘/dev/sdb‘ in read-write mode: Read-only file system.

    解决只读模式U盘保护格式化或者dd写报错:ERROR: failed to open '/dev/sdb' in read-write mode: Read-only file system. 或者: ...

  4. centos6.5报错:checking filesystems failed问题处理

    centos系统重启报错:checking filesystems failed checking filesystems /dev/mapper/vg_0-root: 搜了下可能是文件系统损坏 根据 ...

  5. gitlab报错 fatal: index-pack failed error: RPC failed; result=18, HTTP code = 200解决方案

    gitlab报错 "fatal: index-pack failed error: RPC failed; result=18, HTTP code = 200",如下图 这个问题 ...

  6. cordova编译报错:Execution failed for task ':processDebugResources'

    cordova编译报错:Execution failed for task ':processDebugResources' 引发这个错误的最扩祸首就是一个中文命名的文件,不知道什么时候加入的,我写了 ...

  7. git配置报错fatal: Authentication failed for ‘‘问题解决

    git配置报错fatal: Authentication failed for ''问题解决 参考文章: (1)git配置报错fatal: Authentication failed for ''问题 ...

  8. windows10下编译dllib报错: ERROR: Failed building wheel for dlib

    一.报错信息 在安装dlib的时候,使用pip进行安装 pip install dlib 二.解决方式 1.检查自己是否已经安装了cmake 首先要检测自己本机是否已经安装了cmake,因为安装dli ...

  9. maven 项目报错Context initialization failed

    Context initialization failed 当我对maven 项目进行clean 的时候再次打开就报错Context initialization failed 同时i显示找不到dao ...

最新文章

  1. 2012_01_26
  2. 面试题整理8 字符串的排列
  3. 2021-04-07 In literature VS In the literature
  4. javascript初级代码块
  5. linux git gui使用教程,跨平台最好用的Git GUI工具gitkraken
  6. linux检查防火墙是否阻挡端口,浅析linux查看防火墙状态和对外开放的端口状态...
  7. 52个有效方法(1) - 了解Objective-C语言的起源
  8. matlab用solve解方程错误提示,MATLAB中使用solve解决方程组的问题
  9. Ubuntu ssh 登陆问题
  10. 蓝桥杯ADV-172 算法提高 身份证排序
  11. AcWing 4243. 传递信息(单源最短路)
  12. 提高开发效率的十五个Visual Studio 2010使用技巧
  13. vb改变字形的代码是什么_求VB中调整字体颜色代码
  14. GoogleCode SVN应用(源代码学习)
  15. AI产品经理,如何面对数据挖掘?
  16. Java中的判断语句
  17. itextsharp 获取文本_利用iTextSharp提取PDF文件中的文本内容
  18. java 在线excel_开源Excel在线协同工具
  19. 【群晖nas】阿里域名DDNS 配置外网访问(华硕AC68U路由端口映射)
  20. bzoj1911【APIO2010】特别行动队

热门文章

  1. Unity 协程 yield return的使用
  2. linux网络目的主机不可达,Linux可以Ping通但不能traceroute
  3. build.gradel
  4. 一个传奇的网页游戏平台 遭网友热议 他将如何生存
  5. 汤姆大叔的深入理解JavaScript读后感三(设计模式篇)
  6. 计算机配件对比,电路板对比_手机配件评测_太平洋电脑网PConline
  7. code ELIFECYCLE
  8. java中的try_java中try是什么意思
  9. 数据库 の 联表查询
  10. js如何判断鼠标左键是否按下