mephx wrote:accidentaly chmoded 777 ./.* as root
I'm assuming you used chmod -R 777 ./* from root as root. chmod 777 ./.* would only have changed the permissions on hidden files in the current directory. Either way, it would make the files in question user/group/world readable/writable/executionable. It makes for an insecure system. However, with the exception of files that need to be setuid/setgid, your system should function. Of course you'll want to repair the damage.
mephx wrote:there should be an easy way to store/restore perms. portage or not
If you are just interested in backing up and restoring permissions, you could do:
You could then write a script that feeds the generated list back into chmod to restore. However, a better method would be to tarball your system to DVD. It provides much more protection. Excluding /home, /tmp, and parts of /var, it should fit on one or two disks.
If you happen to have a reference system, you could also take advantage of chmod's --reference=rfile option to fix things.