4

I accidentally executed the chown userx:userx / command.

Is there a way to fix this in a gentle way?

I know the mysql folder has to be owned by mysql:mysql. But what about the other folders? Are there permissions scripts available?

It's a VPS that runs in an Virtuozzo clustered environment with OS Redhat.

migrated from stackoverflow.com Feb 23 '10 at 16:05

This question came from our site for professional and enthusiast programmers.

  • 2
    I feel your pain, but this belongs on ServerFault. – SLaks Feb 23 '10 at 14:31
  • Did you do it recursively? If not, just chown root:root / and you'll be fine. If you did it recursively, then I suggest you re-install the machine. – Wadih M. Feb 23 '10 at 14:32
  • 6
    There are two categories of unix sysadmins: those who have made a mistake as root and those who will. – mouviciel Feb 23 '10 at 14:46
  • For others' reference: if you're using OS X, there's a "Fix Permissions" command in Disk Utility. Do you have backups that preserve the correct permissions? (If not, now's the time to start.) – Benjamin Oakes Feb 23 '10 at 14:51
5

Did you tell it to recursively apply it?

You may find that it did not apply it recursively in which case only the top level will be userx:uxery so you don't actually have to change anything except root:root again.

If you DID NOT chown -R then it should still be fine.

  • I will check this ASAP (the -R thingy), can't access SSH at the moment, the VSP said they're having a big situation there also, don't know if this is the reason for not be able to access SSH. Guess mysql isn't running doesnt answer that question. Besides it's running Plesk. – Johan Feb 23 '10 at 14:36
  • Johan, do NOT use chmod -R... The reason mysql isn't running is not your chmod's mistake. Just let your host resolve their issues first and check again after. – Wadih M. Feb 23 '10 at 14:37
5

If you did your chown recursively:

On a comparable distribution, start this command:

find / -type f -printf "chown %u:%g %h/%f\n" > /tmp/myperm.txt

In the rescue mode of your system source myperm.txt after you chrooted to the root directory of your mounted mess to chown the intended files, this time :-)

This will at least set something correct on most of the files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy