Autorelabel and SELinux Question

If, for example, you rescue your system by editing grub, and adding systemd.unit=rescue.target because you forgot or need to reset user passwords (or even root password), the selinux contexts on the files will be lost. This is why you need to reset the contexts by using autorelabel.

Also, the same is required if you disable selinux and then use your system for a certain amount of time, since none of the contexts will be applied to the files. Then if you suddenly enable selinux again into enforcing mode, chances are it won’t boot or certain services will fail. Thus, autorelabel will fix everything and on the next reboot all will be working fine again with selinux enabled.

1 Like