This is a simple script to solve the ownership issue under cpanel based server. Create an executable file on your server and run.
# echo -e “Checking ownership of /home/user n”
for i in `ls /var/cpanel/users/`
do
if [ “$i” != “root” ]; then
chown -R $i:$i /home/$i
chown $i:nobody /home/$i/public_html /home/$i/.htpasswds
chown $i:mail /home/$i/etc /home/$i/etc/*/shadow /home/$i/etc/*/passwd
echo $i
fi
done