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

I've seen how to do this on linux, however is there a way to do it in OSX?

I've accidentally ran chmod -R 777 /

Looking for how to undo this. Thank you

share|improve this question
2  
How did you do it on Linux? I've never heard of a "command undoer" before. –  VxJasonxV Oct 4 '10 at 16:20
    
Do you have a recent (as in a few hours) Time Machine backup? –  Sven Oct 4 '10 at 16:24
    
sadly no time machine backup.. although this will prompt me to get Time machine setup. –  Petrogad Oct 4 '10 at 16:27
    
getfacl -R >saved-permissions then setfacl --restore=saved-permissions was what I read on another post. –  Petrogad Oct 4 '10 at 16:31
1  
that only works if you think to use getfacl before messing up the perms. –  Gordon Davisson Oct 4 '10 at 20:22

3 Answers 3

up vote 5 down vote accepted

You won't be able to fix it for everything.

First suggestion:
In Disk Utility (Application -> Utilities -> Disk Utility), run "Repair Disk Permissions", note that this will only fix SYSTEM level applications and files. OSX maintains an expected permissions state file, and references it when you Verify/Repair Disk Permissions.
Again, this will recover the most essential things, but not applications/files you've put there yourself, nor your home directory contents, etc.

Second suggestion:
Backup what's important, re-install.

share|improve this answer

As Jason says, Disk Utility should get most of the OS's stuff. For the rest, perhaps you could assume defaults of 644 for files, 755 for directories, except in /Users where 600 and 700 might be more appropriate? This won't put everything exactly as it was, but it should keep most stuff working and you can fix up special cases as you find them.

The best order would probably be

chmod -R 644 / # Set everything to owner read/write, others read
chmod -R a+X / # Add execute for all on directories
Then run the Disk Utility to let it patch up what it can on top of those base permissions.

I assume the Disk Utility will do things like making the contents of /bin executable.

This all off the top of my head and untested; I'd recommend testing the chmods on a small subtree before running them across the whole disk.

If you can reinstall that might be better for longterm peace of mind. I'd happily perform a kludge like this on one of my test boxes, but maybe not on my personal workstation.

Pete

share|improve this answer

There's no way of "undoing" a chmod,sshort of going through a known-good installation and checking/reproducing permissions. The easiest way out for you is a complete re-install.

share|improve this answer

Your Answer

 
discard

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.