Correcting ownership of all cPanel Users

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


# Login to server as a root
# create a shell script and enter the code below :
# vi
Code to be entered :
for i in `cat /etc/trueuserdomains | awk β€˜{print $2}’`
/bin/chown $i.$i /home/$i -R;
/bin/chown $i.mail /home/$i/etc -R;
/bin/chown $i.nobody /home/$i/public_html;

Save the file and change the permission for the file permissions.
# chmod 755
Then run the script.
# ./

It will take some time according to the amount of users and The ownership of the home directory of a user, etc and public_tml will be corrected in a one go.


πŸ™‚ πŸ™‚ πŸ™‚

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: