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)