0

I accidentally did this:

chmod -R 777 /

I suppose to do this:

chmod -R 777 ./

I feel really bad now. How can I reverse this??

9
  • Don't feel bad. It'd have been worse if you did sudo chmod -R -x /.
    – devnull
    Aug 21, 2013 at 14:39
  • 1
    There are two kinds of people in the world. Those who have destroyed a file system running as root -- and those who haven't done it yet. Don't run as root ;) Aug 21, 2013 at 14:40
  • At least now I feel no sleepy no more. Again, GOD!
    – Hao
    Aug 21, 2013 at 14:44
  • 2
    See this answer.
    – Kevin
    Aug 23, 2013 at 15:45
  • 1
    chmod -R 777 ./ would have been wrong too. It is extremely rare to need to set files to mode 777. I can't think of ever needing to set a whole directory hierarchy to mode 777. chmod -R a+rx . or chmod -R u+w . are common. chmod -R 777 . was a mistake from the start. Aug 23, 2013 at 16:22

1 Answer 1

3

short version: You can't. Unless you have a backup or similar which lists the permissions of all your files, you don't know what the files need to be.

4
  • God. Won't CentOS provide some tools to do permissions...RESET or some sort?
    – Hao
    Aug 21, 2013 at 14:39
  • Sorry, no, there isn't.
    – Oliver Matthews
    Aug 21, 2013 at 14:43
  • 3
    for allpkg in $(rpm -qa); do rpm --setperms $allpkg; done resets file permissions for all installed packages. This does not help with user files...
    – Roland Jansen
    Aug 21, 2013 at 14:46
  • 1
    @Jusfeel There is a tool to reset permissions. It's called restoring from a backup. If you want to avoid some data copying, it's possible to restore the permissions while leaving the data in place. How to do that depends on what backup tool you used. Aug 23, 2013 at 16:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .