Help Center > > FAQs> OS Management> OS Faults> How Can I Enable SELinux on an ECS Running CentOS?

How Can I Enable SELinux on an ECS Running CentOS?

Updated at: Dec 16, 2019 GMT+08:00


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.


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 to make the configuration take effect:

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

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?

Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel