How do I restore permissions of all the rpm packages on system to default?

The rpm allows you to restore the owner and permissions of files coming from a rpm package

Run below commands to reset permissions of files from all installed packages.
Raw

 rpm --setugids PACKAGE_NAME - sets user/group ownership of files in the given package.
 rpm --setperms PACKAGE_NAME - sets permissions of files in the given package.

The -a (all) causes the restore procedure is performed on all files of rpms.
Raw

# rpm -a --setugids
# rpm -a --setperms