Using the restorecon command is the most popular and preferred way of modifying the SELinux context of a file or directory. As is visible from the name of the restorecon command, it is used to restore the default context of a file or directory by reading the default rules set in the SELinux policy. If the wrong context is applied, restorecon automatically corrects it from the policy of the filesystem.
In the following example, we simulate a problem scenario, in which a file has incorrect syntax and we correct it using the restorecon command:

The restorecon command is a part of the policycoreutil ...

