0

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.

Salman
  • 105
  • 1
  • 9
  • Also possible duplicate of [How do I restore default owner of files in /var directory](http://unix.stackexchange.com/questions/35345/how-do-i-restore-default-owner-of-files-in-var-directory)? – dr_ Jul 03 '15 at 12:27
  • The uniq answer to this question seems to be one of the simplest and most focused. – dan Jul 03 '15 at 12:51

1 Answers1

0

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.

coteyr
  • 4,280
  • 16
  • 24