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.

2 Responses

  1. Does this work for CentOs with Plesk?

  2. @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.

Leave a Reply