help - i chowned the whole /var directory to root

ctbhost

Well-Known Member
May 31, 2002
138
0
316
ok first thing is i am a dill :eek:
i was meaning to chown the /var/backup/ folder to root

but instead i did the whole /var/ and all sub directories to root

what is the best way to rectify this - without using a big hammer :)

thanks
 

asmithjr

Well-Known Member
Jun 13, 2003
516
8
168
Do you have another server to compare with?

If so, you could start with a command like this

cd /var
find . -ls | awk '{printf "chown %s:%s %s\n",$5,$6,$11}' > /tmp/mychown

this will create a file in /tmp called mychown that has lines like

chown root:root ./cpanel/zonetemplates/simple

The file will be based on your other servers ownerships