Instead of changing the ownership of /var/www directory, I changed the ownership of /var directory recursively (couple of days back). Now owner of every directory in /var is www-data. All my sites are down and showing "Error establishing a database connection."

There are 12 directories in /var folder : backups, cache, lib, local, lock, log, mail, opt, run, spool, tmp, www

Now how I will rectify my mistake? I don't know which directory is owned by which user. Do I have to find about the owner of each folder one by one and change its permission settings or there is some other way to do it ?

(Operating system : Debian 7.8)

  • 5
    Restore from, or consult the backups you ought to have to determine the proper owners. – HopelessN00b Feb 5 '15 at 17:42
  • 1
    It is a waste of time doing anything but restoring. – Sirch Feb 5 '15 at 18:09

Install fresh Debian on separate server. Check owners and set the same on your current server.

| improve this answer | |
  • 1
    This doesn't help with the files installed manually by the user. – Tero Kilkanen Feb 5 '15 at 20:12

Your Answer

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

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