I'm afraid there is no quickly for this fix. Look at the link provided by ooshro to find ways to reset permissions for packages. As for the data on the system, that will probably have to be changed by hand.
–
karategeek6Mar 1 '11 at 15:27

You have backups, right? Hopefully ones that include both files and filesystem metadata? If this happened in my environment, I'd pull last night's backup down to fresh disks and get booted on that. Hope it works out for you!

Ran into this myself. Basically what you could do is to install the same version of the OS or better yet, if you have another system installed with the same OS and it's still intact, do an ls -al inventory of all the files then run it through a script to change them back to the same permissions. You could use associative arrays to do this with by storing the known permissions then rereading them to set it on the effected host.