Sign up ×
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
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

4 Answers 4

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

I have exact same problem.

rpm -a --setperms

fixed the problem.

share|improve this answer
What value does this offer over the answers from six years ago? – Sven Jun 13 at 11:08

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

protected by Sven Jun 13 at 11:06

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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