Fixing file ownership and permissions after cPanel transfer

This is a problem that’s hit me a couple of times, and it seems to be an issue with only some transfers. From what I can see so far it’s only when an account on some versions of WHM that are being transferred to another version of WHM that have this problem.

The basics of what happens is that the sites /public_html/ folder looses it’s correct file ownership, so the site can’t write to the files. In WordPress you see this when the site can’t be updated or media files can’t be uploaded.

Please note: To be able to use these fixes you must be logged into the server using the root account, or with an account that has sudo abilities.

Step 1: Fix file ownership

In the terminal, go to your sites home folder and run this command:

chown -R {username}:{groupname} public_html/

Note that you’ll need to set the username and groupname properties to suit your site. You’ll be able to see these on the other folders in the sites root home directory.

Step 2: Fix file permissions

Move to the public_html folder of your site, and run this command to set the correct file permissions of 755 for folders and 644 for files:

find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 644 {} \;

Leave a Reply

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