首页 文章

在CentOS 5.10框上禁用SELinux会话

提问于
浏览
0

我有一些问题正在改变目录权限,看起来它们与SELinux有关 . 我正在试图弄清楚如何禁用SELinux a)剩余的厨师 - 客户会话和b)永久 .

资源:

# Change permissions for mounted repository
directory "/home/analytics" do
  owner "analytics"
  mode "711"
end

错误:

/sbin/restorecon set context /analytics/file failed:'Operation not supported'

环境:

看起来SELinux正在破坏这些作品 . 大 . 让我们禁用SELinux!

Chef's box中的库存配置设置为许可 .

[root@analytics selinux]# cat /etc/selinux/config
# 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 - SELinux is fully disabled.
SELINUX=permissive
# SELINUXTYPE= type of policy in use. Possible values are:
#   targeted - Only targeted network daemons are protected.
#   strict - Full SELinux protection.
SELINUXTYPE=targeted

我可以模板化配置并设置为禁用,但这只会在重启后应用 . 通常在当前会话中禁用SELinux是通过CLI(sestatus,setenforce等)完成的 . 我们的食谱(和the official one)依赖于此功能 . 但它似乎在这里被打破了......

[root@analytics selinux]# sestatus
bash: sestatus: command not found
[root@analytics selinux]# getstatus
bash: getstatus: command not found

[root@analytics selinux]# rpm -q policycoreutils
policycoreutils-1.33.12-14.13.el5

那么如何在不重启盒子或运行Chef两次的情况下禁用SELinux呢?

1 回答

  • 0

    我修复了我的问题,创建了一个新的.box,并将/ etc / selinux / config中的设置设置为DISABLED .

    但@szpal是对的 . 二进制文件在/ usr / sbin下(而不是/ sbin,我一直在寻找):

    [vagrant@analytics-centos-510 sbin]$ ls /usr/sbin/se* /usr/sbin/selinuxenabled /usr/sbin/semodule /usr/sbin/sestatus /usr/sbin/semanage /usr/sbin/setenforce
    

    快速测试表明您可以通过简单地提供执行资源的完整路径来禁用会话中的SELinux:

    execute "disable selinux - running" do
          command "/usr/sbin/setenforce 0"
    end
    

相关问题