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 have a Linux web server with multiple sites being hosted with CPanel. I was having trouble accessing a site, so I ran this command: chown -R root:root /home/evalreal/. While waiting for the command I start seeing a bunch of errors. The errors went something like /home/evalreal/public_html/../virtfs/home/*Other website folders* Could not be accessed

So, I messed something up with my command and applied these owners across a large amount of my /?

My web sites went down until I reset their permissions from a back up. My /tmp directory and /var/lib/mysql directory are both running 777 for the time being. I need to do something similar for whatever is hampering Exim. I can't tell what got changed but since I was root when I ran the command I suspect it's a lot.

Ultimately I need to have the entire system restored from backups right? What if I can't do that for a day or so?

share|improve this question
Great answers below. For future reference, try adding getfacl -R / to your backup scripts. Then, a quick setfacl --restore=<backup file> will recover your ACLs. – Belmin Fernandez Jan 15 '13 at 13:15
up vote 7 down vote accepted

First, Look on the bright side: At least you HAVE backups.
Many people who wind up in your situation do not, and they get very cranky when we tell them the best thing to do is restore from their (nonexistent) backup...

Ultimately I need to have the entire system restored from backups right?
This is likely to be the most expedient solution (If you can restore just permissions that might be preferable as you won't risk losing any work).

Your other option is to determine what files have been affected and manually reset their ownership. There is somewhat more margin for error here though: The directory tree was walked recursively so you can use find -user root one level above where the chown was rooted to help you sort through the damage.
(This only applies if you stopped the chown -- If it ran through the whole system you're well and truly hosed and backups are your best option.)

What if I can't do that for a day or so?
Then you will be down (or at least impaired) for a day or so.
There are no shortcuts in system administration (well, there are, but not in this case. You need to undo the ownership change you made somehow, either manually or by restoring from backups.)

share|improve this answer

The great advice regarding restore from backup by voretaq7 aside ... you didn't mention the distro you're using; if it is rpm based you might be able to do this as root:

for p in $(rpm -qa); do rpm --setperms $p; done
for p in $(rpm -qa); do rpm --setugids $p; done

That will at least set everything back to normal for package provided files/dirs.

share|improve this answer
This still leaves you with the problem of having to restore permissions on anything that didn't come with the operating system (like webroot directories), but it will at least leave you with a working system... – voretaq7 Jan 15 '13 at 16:01

Your Answer


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.