Ownership problem for cPanel users

Sometimes when we migrate the servers by using rsync command then we face ownership problems for cPanel users files/directories. If you face that problem then just run below command on shell as a root user.

for i in `cat /etc/trueuserdomains | awk ‘{print $2}’`
do
chown $i.$i /home/$i -R;
chown $i.mail /home/$i/etc -R;
chown $i.nobody /home/$i/public_html;
done;

That’s all you are done.