Restore permissions on Red Hat
Introduction
A colleague of mine made a serious mistake (running chown -Rf mysql
on /
!). This caused a huge mess, and we had to find a solution to restore the correct permissions.
Fortunately, Red Hat anticipated these kinds of errors and included the --setperms
and --setugids
options in the rpm
command to repair permissions on installed packages. Basically, this gives you a way to repair your machine.
So if you also made a mistake like this, know that there is a solution on Red Hat.
Usage
Here are the two magic commands:
You'll need to do a bit of verification afterward because this only repairs the permissions of files and directories contained in installed packages. Your personal files will not have their permissions restored with this method.