How to fix cpanel user ownership serverwide

Here is a simple script to fix the ownership issue on cPanel/WHM based servers. To run this script you have to create an executable file on your server and run it.

# 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
fid
one

That’s all. Also give your opinion below if you experience any issues or to discuss your ideas and experiences.