Manage Permissions with RPM

There can be times which permissions are reset on a directory without knowing what the permissions were previously. There are no records of this anywhere within the log files as standard on a linux server.

When permissions are modified on standard package installed files it is very easy to reset those permissions to what they should be by default.

You can use the RPM command to reset the permissions of select packages, for example to reset all permissions for the httpd package you could use the command :

rpm –set-perms httpd

You can also reset the ownership of the files associated with a package by using the following command, once again for the httpd package :

rpm –setugids httpd

If you have caused a catastrophic problem and would like to reset all permissions across all packages you can use the following two for bash commands :

for package in $(rpm -qa); do rpm –setperms $package; done
for package in $(rpm -qa); do rpm –setugids $package; done

This entry was posted in Managed Hosting. Bookmark the permalink.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>