CAll Us: World: +1 541 678 7323 | India: +91 86686 23778

How to Fix Ownership of cPanel accounts Server wide?

In order to fix the ownership of all cPanel users server wide, you need to execute below Shell script

If you are having a Shared Hosting or Reseller Hosting account then you need to get in touch with your Hosting Provider to fix ownership issue as the below script will fix ownership of all cPanel accounts server wide.

If you have a shell access to your cPanel Server you can use below method to fix ownership issue server wide.

Login to Shell and execute below commands

# vi fixowner.sh

Copy below script in Editor and Save it

#!/bin/bash
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
fi
done

Assign 755 executable permission to your Script with below command

# chmod 755 fixowner.sh

Now run script to fix Ownership of user accounts server wide.

# ./fixowner.sh

Now you will notice that Ownership issue of server wide cPanel accounts has been fixed