Rebuild RPM file permissions and ownerships

If you find that someone has done a recursive chmod or chown on a server, don't fret. You can set almost everything back to its original permissions and ownership by doing the following:

rpm -qa | xargs rpm --setperms --setugids

Depending on how many packages are installed as well as the speed of your disk I/O, this may take a while to complete.

Printed from: http://rackerhacker.com/2007/06/14/rebuild-rpm-file-permissions-and-ownerships/ .
© Major Hayden 2012.

2 Comments   »

  • Sunshine says:

    Does this work for CentOs with Plesk?

  • major says:

    @Sunshine: Yes, it does work for CentOS with Plesk. However, if you change permissions on some of the Plesk binaries and utilities, some of them won't be changed. This is because many of the Plesk RPM's install the files with post-install scripts rather than just laying the files down like most RPM's do.

RSS feed for comments on this post

Leave a Reply

 

  • Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you find the information useful. If you spot something that's incorrect or confusing, please write a comment and let me know. Drop me a line if there's something you want to know more about and I'll do my best to write a post on the topic.
    -- Major Hayden

    Flattr this