Pages

Friday, April 12, 2013

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 permissions.sh
Code to be entered :

====================

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;
done;

====================

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

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.

No comments:

Post a Comment