Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I made the fatal error of copying and pasting a sudo command into my terminal without double checking it, here it is.

sudo -R mysql /

What this does (for those that don't know) is recursively change the owner every file from the root down to mysql!! obviously not what i was intending

This has of course played havoc with my system, the first thing i did was the apple permission repair but that only works for files that it has an idea of though it has changed a lot of file ownerships back to root. It seems that many library files are still owned incorrectly, as a lot of problems don't work. What i propose doing as a temporary fix until i can reinstall mountain lion is to recursively set all ownerships that are mysql to Luke. I'm not sure what they should precisely but this is still better than nothing. Is this possible using a shell script?

I realise that this won't fix the problem properly and i will have to reformat but i need the machine in a workable state just for this week.

share|improve this question

3 Answers 3

Repair Permissions Lion, ML &c via their hidden feature

In Lion, ML, Mavericks... repairing permissions with Disk Utility, as is usually done, does NOT repair User file permissions.

Using a hidden feature by following the steps below will repair permissions does a better, more thorough job, and often fixes strange issues:

  1. Restart, and immediately upon hearing the chime, hold down Command+R to access the 'OS X Repair partition' utilities in Recovery mode.
  2. Now at the 'Repair Utilities' screen, click the 'Utilities' item in the Menu Bar. [[ Iff disk encryption's used, quit Mac OSX Utilities; at the prompt for 'Startup Disk' unlock it with the password. Then run the Terminal app. ]]
  3. Scroll down to find the Terminal application and double-click it to launch it.
  4. When its Terminal window opens, carefully type resetpassword within this windowand and then hit the Return key.
  5. The 'Password Reset Utility' window launches, (but resetting the password is not the point and so won't be done).
  6. Click Mac’s hard drive icon at top-left, and within the drop-down menu, select the user account experiencing issues.
  7. Then find at the bottom of the 'Password Reset Utility' window the 'Reset Home Directory Permissions and ACLs' button —> click it.

    Within a few minutes this reset process finishes, and then quit each open program. and then click 'Restart.' This fixes many problems related to the User, Home folder items, and the like.

This “Reset Home Directory Permissions and ACLs” technique works for previous OS X versions by use of the original OS X Install DVD.

share|improve this answer

Those sound like valid options. But your first assumption would be the best way to go. The repair permissions function in OS X will get most of the system files; but if the issue is you can't run things as yourself, and you've only changed the user and not the group, then running 'sudo chown -R luke /' followed by repairing the permissions again will get you back to mostly useable until (or if) you reinstall.

As for fixing permissions in your user directory; you only changed the ownership... so 'sudo chmod -R luke /Users/luke' will fix that muuuch quicker than any tools will (might need to capitalize Luke, depending on your username on the computer.)

share|improve this answer

If it's' OSX, then just reinstall the os. It won't wreck your data, it'll just bring the system files closer to default.

Then try going into the Recovery drive, if you have it, open Terminal from the menu, Type

resetpassword

and a window will pop up. At the bottom of that window is an option to reset the user ACL's.

That should fix your home directory.

Or, you could just use Onyx, there is a reset ACL's option there as well.

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.