Correcting ownership of all cPanel Users

If you mess up with the ownership of all the users on a cPanel server, following script will help you to correct the ownership:

#!/bin/bash
for i in `cat /etc/trueuserdomains | awk ‘{print $2}’`
do
/bin/chown $i.$i /home/$i -R;
/bin/chown $i.mail /home/$i/etc -R;
/bin/chown $i.nobody /home/$i/public_html;
echo "ownership has been corrected now."
done

The ownership of the home directory of a user, etc and public_html will be corrected in a one go

Correcting ownership of all cPanel Users

Leave a Reply

Your email address will not be published. Required fields are marked *

Fork me on GitHub