Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

migrated from Feb 23 '10 at 16:05

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

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
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

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.

share|improve this answer
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

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.

share|improve this answer

There is no way to really restore it and you will always miss something that requires certain permissions.

The only way to get around reinstalling everything is chmod 777 on everything which makes the system unsafe but at least it will still work after a reboot.

I recommend you backup, reinstall and restore the backup without keeping backed up permissions.

PS: It's not a noob mistake, it happens to everyone (including myself, except it was a chmod 700 on everything in my case)

share|improve this answer
If he didn't use the -R switch, he can fix it easily. – Wadih M. Feb 23 '10 at 14:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.