title: Disable SELinux in-session on CentOS 5.10 box
body: <p>I'm having some issues changing directory permissions that LOOK like they're related to SELinux.  I'm trying to figure out how to disable SELinux a) for the remainder of the chef-client session and b) permanently.</p>
  
  <p>Resource:</p>
  
  <pre><code># Change permissions for mounted repository
  directory "/home/analytics" do
    owner "analytics"
    mode "711"
  end
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>/sbin/restorecon set context /analytics/file failed:'Operation not supported'
  </code></pre>
  
  <p>Environment:</p>
  
  <ul>
  <li>Test Kitchen, Vagrant driver, and VirtualBox.</li>
  <li>Box - <a href="http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.10-i386_chef-provisionerless.box" rel="nofollow">Chef provisionerless centos-5.10</a>.</li>
  </ul>
  
  <p>Looks like SELinux is mucking up the works.  Great.  Let's disable SELinux!</p>
  
  <p>The stock config from Chef's box is set to permissive.  </p>
  
  <pre><code>[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
  </code></pre>
  
  <p>I can template the config and set to disabled, but that will only apply after reboot.  Usually disabling SELinux in the current session is done via the CLI (sestatus, setenforce, etc).  Our cookbooks (and <a href="https://github.com/skottler/selinux/blob/master/providers/state.rb" rel="nofollow">the official one</a>) rely on this functionality.  But it appears to be broken here...</p>
  
  <pre><code>[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
  </code></pre>
  
  <p>So how do I disable SELinux without rebooting the box or running Chef twice?</p>