Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have many programs installed, I want to keep my history, and so on and so on.. What can I do to save the situation? Thank you.

share|improve this question
    
Similar Q on UL: Wrongly set chmod / 777. Problems? –  gertvdijk Jan 31 '13 at 14:31
    
Thank you gertvdijk. –  Perlnika Jan 31 '13 at 14:34

2 Answers 2

You've just found the great powers of being root and how easy it is to screw up your whole system!

I would recommend reinstalling the complete system, because, I can't agree more to what Gilles said in a similar question:

Can it be fixed? Sure. Faster than reinstalling? Probably not.

So, as this is not easy to fix yourself by hands within reasonable time and effort. And if you try, you'll notice a lot of stuff will break: sudo, setuid/setgid binaries, etc.

General steps for a reinstallation:

  1. Back up your data, e.g. /home/username.
  2. Back up configuration files: /etc
  3. Get a list of manually installed packages, which allows you to reinstall them quickly in the new installation.
  4. Restore the configuration files selectively. Don't bluntly restore complete /etc as that will break stuff. Only restore files you actually touched yourself.
  5. Restore your data.

Done.

I'm looking forward to the time that we have Btrfs as the default file system and we can restore our complete system by simply reverting to a snapshot.

share|improve this answer
    
Thanks. Will do it this way. –  Perlnika Jan 31 '13 at 14:49

For changing permissions only for folders (directories), recursively, you can use:

sudo find ./ -type d -exec chmod 755 {} \;

For changing permissions only for files, recursively, you can use:

sudo find ./ -type f -exec chmod 640 {} \;

Considering you run the command with 755, you only need to run the command for the files.

Be aware that these commands run in the folder you are in (./).

share|improve this answer
    
I believe this is not useful when all filesystems from / are touched as in the question. Some files/dirs are required to be more secure or have setuid/setgid flags for example, whereas others should be more relaxed (e.g. /tmp). –  gertvdijk Jan 31 '13 at 14:09
    
That's right. Even if the commands offer a way of doing it recursively, changing the files and folders which has different permission may take a long time... –  YuriC Jan 31 '13 at 14:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.