I have recursively changed owner and group of /var to root:root. I have mistakenly ran following command while standing in /var. I thought I was in /var/www,

sudo chown root:root . R

Now many things are stopped working, my system was fresh, only LAMP was installed. Now what should I do? Reinstall my system or is there any way to change owner and group to default state?

It is Debian 8 with LXDE.


First, if you don't have a backup that's gonna be pretty rough. There is no "back to default" or "fix permissions" on Linux outside a backup or reinstalling the packages.

I would reboot, then check /var/log/syslog and see what didin't start and manually change those directories. You could chmod a+rw /var/* -R but that's not a great solution.

You could also check package ownership of every file under /var/ and reinstall it, but again, not a great solution.

Basically I would recommend going through and seeing what services fail to start after a reboot (some services will fix the files them selves) and manually fixing those. It shouldn't be too bad.

| improve this answer | |
  • 1
    "that's not a great solution": fully agreed. Restore backup or reinstall. – dan Jul 3 '15 at 11:37
  • "my system was fresh, only LAMP was installed." - so just reinstall, no big deal. – steve Jul 3 '15 at 12:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.