How do I restore and accidental chmod (or chown, chgrp) of root directory?

7

3

I was altering permissions to log files and accidentally gave 777 to root. Doah. Could be worse I guess. And I caught it immediately and canceled the command's execution.

Except the accident brought to mind that I run in root a lot. I use both Macintosh and Linux. Mac has a repair permissions utility. What about Linux? I there a utility to restore Linux (and in my case Fedora) to baseline user, group, and permissions to ensure the system will boot?


UPDATE: Been a few weeks now and no new problems found. I'm going to accept that this is solved.

xtian

Posted 2011-07-27T16:15:58.920

Reputation: 782

Which distribution? – h0tw1r3 – 2011-07-27T16:21:55.000

2/ or /root? And I assume you added -R for recursive? – Daniel Beck – 2011-07-27T16:28:15.400

... my first though would be to reinstall. The permissions on a Linux system tend to get rather complex in a short amount of time, due to the fact that many daemons you install have their own users, and their own groups, and the average system user (i.e your login) has at least 5 groups they are a part of. – new123456 – 2011-07-27T16:39:16.497

Fedora 15; it was "/" with recursive (>_<) – xtian – 2011-07-27T19:17:36.703

Answers

7

For rpm based distributions it's easy to reset all managed files back to the installed state.

rpm --setugids -a # To reset ownership
rpm --setperms -a # To reset permissions

Replace '-a' with package name(s) to limit reset.

h0tw1r3

Posted 2011-07-27T16:15:58.920

Reputation: 1 408

Yeah! I'm using Fedora 15 and YUM which is rpm based... – xtian – 2011-07-27T19:20:58.450