Help Center/ Elastic Cloud Server/ User Guide (Kuala Lumpur Region)/ FAQs/ OS Management/ OS Faults/ How Can I Enable SELinux on an ECS Running CentOS?
Updated on 2024-04-19 GMT+08:00

How Can I Enable SELinux on an ECS Running CentOS?

Symptom

SELinux is disabled on ECSs running CentOS 7.5 by default. After I enable SELinux by running /etc/selinux/config and enter the login password, the login failed.

This section describes how to resolve this issue based on enabled SELinux.

Solution

The operations described in this section are performed on ECSs running CentOS 7.5.

  1. Run the following command to change SELINUX=disabled in the SELinux configuration file to SELINUX=enforcing:

    vim /etc/selinux/config

  2. Run the following command to automatically enable SELINUX on the file system upon ECS restarting:

    touch /.autorelabel

  3. Run the following command to restart the ECS for the configuration to take effect:
    reboot

    After the preceding command is executed, the system automatically restarts twice.