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.

 

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

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: