Reset the File Permissions on a Fedora Machine

Written by James McDonald

August 14, 2011

Just recently I discovered a problem caused by a trial software install. Files in /usr had been changed to be owned by someone other than root. (postgres).

I did try to fix the problem by running chmod root:root /usr -R

But I’m not confident that everything is now correctly owned.

Because it’s an RPM packaged system I can use rpm to help with resetting ownership (–setugids) and permissions (–setperms) as follows:

rpm -qa | xargs -IFILE rpm --setugids --setperms FILE

The command basically says query the rpm database (-q) for all installed packages (-a) pipe the list of packages to xargs and run rpm with the –setugids and –setperms flags set on each package to fix up it’s perms.

If you run the above you will see alot of “No such file or directory” messages.

Note: Do the above at your own risk.


Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…