2

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?

2
  • See serverfault.com/questions/40025/… Sep 2, 2009 at 14:24
  • 1
    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. Sep 2, 2009 at 14:25

4 Answers 4

1

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.

1
  • 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, 2009 at 23:11
4

I have exact same problem.

rpm -a --setperms

fixed the problem.

1
  • 1
    What value does this offer over the answers from six years ago?
    – Sven
    Jun 13, 2015 at 11:08
3

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.

1
  • 1
    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, 2009 at 7:17
0

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.

Sean

You must log in to answer this question.

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