I accidentally wreaked unknown amounts of havoc on my web server by running
sudo chown -R myuser:mygroup * .*
in /var/www, not remembering that .* would include the parent directory (as ..). I realized what was happening after a second or so, but by then it was too late, half the directories in /var had been "re-owned". I know I can reset most of it with
sudo chown -R root:root /var
but what files are there that need to be owned by specific non-root users (or groups) that I would have to change manually?
This is on Gentoo, and here's a directory listing:
$ ls -l /var
drwxr-xr-x 9 root root 4096 May 12 2009 cache
drwxr-xr-x 4 root root 4096 Aug 20 22:49 db
drwxr-xr-x 3 root root 4096 Aug 20 22:42 dist
drwxr-xr-x 4 root root 4096 Nov 1 2009 edata
drwxr-xr-x 2 root root 4096 Jun 17 2008 empty
drwxr-xr-x 5 git git 4096 Feb 13 2010 git
drwxr-xr-x 23 root root 4096 Jul 19 03:22 lib
drwxrwxr-x 3 root uucp 4096 Aug 12 00:14 lock
drwxr-xr-x 10 root root 4096 Aug 20 03:10 log
lrwxrwxrwx 1 root root 15 Nov 7 2008 mail -> /var/spool/mail
drwxr-xr-x 10 root root 4096 Aug 21 00:22 run
drwxr-xr-x 8 root root 4096 Feb 13 2010 spool
drwxr-xr-x 2 root root 4096 Jun 17 2008 state
drwxr-xr-x 13 root root 4096 Dec 23 2009 svn
drwxrwxrwt 5 root root 4096 Aug 14 01:53 tmp
drwxr-xr-x 13 root root 4096 Aug 11 20:21 www
drwxr-xr-x 2 root root 4096 Dec 14 2008 www-cache
I can provide listings of subdirectories if it would help but that gets pretty long pretty fast. (dist, edata, git, svn, and www are things I manage myself so ownership in those won't be an issue)

/var/. you might want to show what directories you have with anls -l /var, that way people can help you by telling you what ownership those directories have for them. – xenoterracide♦ Aug 21 '10 at 4:42/var/log/apache2or some such... iirc – xenoterracide♦ Aug 21 '10 at 6:57