Have you ever been playing around in root, and accidentally misplaced a period in your chown command, and completely mucked up your system? This script attempts to correct that, although the author recommends that if possible, you should do a reinstall instead. If that is not an option, then this script may be a solution.

Step 1
Freshly install a new operating system on another computer, that resembles your broken operating system as close as possible. For example, make sure the user names are the same, the ISO image is the same, and the same programs are installed.

Step 2
Run the script on the clean operating system. It will generate a Bash Script. Note: you can specify which portion of the operating system you wish to fix. Thus for example, if it is only your /usr folder that has been affected, you simply choose /usr when prompted. choose / to have it apply to the whole operating system

Step 3
Transfer that bash script to your broken operating system, and run. It will do a' sudo chown user file' for each specified file and folder.