Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I know they say that given root access, someone will eventually type before they think and fubar their machine, and I just did.

I did a recursive chmod changing everything to 775 thinking I was in a sub directory, but alas, I was in /. Is there any magical way to undo this, or at the very least, get a list of default directory permissions and manually restore them?

share|improve this question
See serverfault.com/questions/40025/… –  Evan Anderson Sep 2 '09 at 14:24
The "real" way is to restore from backup. Assuming you don't have backups, have a look at that question-- there are some ideas that can get you most of the way there, depending on what distro you're running, etc. –  Evan Anderson Sep 2 '09 at 14:25

3 Answers 3

up vote 1 down vote accepted

There's no undo. Beyond installing a box with similar unix, and scripting something to check everything permissions, I don't believe there's a list of default permissions either. Not very helpful, unfortunately.

share|improve this answer
Accepting this answer because, well, "There's no undo". I just re-installed the server (all important files were backed up but not generic system files and such). The other RPM-based solutions presented sound nice but this is Debian =/ –  DWilliams Sep 3 '09 at 23:11

If your distribution is rpm based, the rpm database contains permission information. The command

rpm --setperms {packagename}

should reset the permission for the given package.

share|improve this answer
you can simply do : rpm -a --setperms on rpm based distros in order to restore most of permissions (run it as root) –  Razique Sep 3 '09 at 7:17

To amend the "rpm --setperms" information, that will allow you to fix the permissions of all files and directories which were installed as RPM packages. It will NOT fix the permissions of files that were installed without using RPM.

You can get a list of all the installed packages by doing "rpm -qa", for use in feeding to the "rpm --setperms". You can also use "rpm -Va | less" to have RPM do an integrity check on all installed files and directories to allow you to do more fine-grained adjusting of permissions -- it will report if the file contents, modes, and times have changed, and whether the file is a configuration file or not.


share|improve this answer

Your Answer


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.