Fix files and folder permission in cpanel

We come across permission issues every now and then working on cpanel server. I have a client who uses github as his development modules and he pushes code on the server everyday and come across this issue. So I mostly use below mentioned command to fix his errors at one go.

Login to the SSH terminal (No need to have root privileges) using your user (as provided by hosting provider).

Go to public_html folder and then fire this command:

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

 

If you are outside public_html folder please use below mentioned command to fix permission error.

Please make sure you enter your cpanel username in place of cpanel-user

find /home/cpanel-user/public_html/ -type d -exec chmod 755 {} \;
find /home/cpanel-user/public_html/ -type f -exec chmod 644 {} \;

Leave a Reply