# SELinux

> If required by your organization and you need to opt in to using SELinux, follow these instructions to enable SELinux on your Cloud Management Platform (CMP) host

---

Site [llms.txt](/llms.txt)

---

## Before you begin

**Take a VM snapshot of your CMP host before making any operating system changes.**

## Enabling SELinux

Log in to your CMP host and run the following command: `getenforce`. If this reports that [SELinux](https://www.redhat.com/en/topics/linux/what-is-selinux) is *disabled*, run the following command, then reboot the host:

```text
sed -i "s/SELINUX=.*$/SELINUX=permissive/g" /etc/selinux/config
```

This will tell the host to run in *permissive* SELinux mode upon reboot.

## Permissive SELinux

To set SELinux back to *Permissive* mode, run the following commands on the host:

```text
setenforce permissive
sed -i "s/SELINUX=.*$/SELINUX=permissive/g" /etc/selinux/config
```

## Enforcing SELinux

If `getenforce` reports that SELinux is in *permissive* mode, run the following command to temporarily set the host in *enforcing* mode:

```text
setenforce enforcing
```

To permanently set the host in *enforcing* mode, run the following command and reboot the host:

```text
sed -i "s/SELINUX=.*$/SELINUX=enforcing/g" /etc/selinux/config
```

This will put the host in *enforcing* mode when it reboots.
