Fix permissions on files and folders in a cPanel server

Fix permissions on files and folders in a cPanel server running SuPHP and FastCGI

Files and folders on a cPanel server require set permissions and owners to function correctly. If you have the wrong permissions on a file or folder it’s likely this will break part or all of the website that account is running resulting in Internal Server Errors. Likewise, if you have the wrong owner assigned to these files and folders this will also likely stop your website or application from running. We have already covered how to find out what user is assigned to files and folders but what if you’re looking for an automated way to fix permissions on files either in a single account or server wide.

We found a handy little script on gib-hub created by Jacob Tirey. This script will search through your files and folders and ensure the correct permissions and owners are assigned to the right files. You can run this on a per-user basis or server-wide.

You should run this script on servers running SuPHP and FastCGI for best results. We’d advise not to run this on a DSO server but according to the author this would work but you may need to check the ownership of some files and folders.

To get the script you can copy the code below

wget https://raw.githubusercontent.com/PeachFlame/cPanel-fixperms/master/fixperms.sh
chmod +x fixperms.sh

You can run this scripts in two ways, either for a single account or across the whole server;

To run this for a specific user, just swap First2Host for the cPanel username to run this script for;

sh ./fixperms.sh -a First2Host

To run this script server wide and attempt to fix any incorrect permissions ;

sh ./fixperms.sh -all

We’ve tested this script on SuPHP and FastCGI servers and it causes no ill effects what-so-ever. It’s totally safe to run for a quick fix to annoying permission problems.

How was this article? –

Fix permissions on files and folders in a cPanel server running SuPHP and FastCGI

Fix permissions on files and folders in a cPanel server
7 5 100%
cPanel VPS Server

cPanel

Select Language
SSD Reseller Web Hosting ★ Host 50 Domains ★ 50 Free SSL Certificates ★ Weekly Backups ★ Free Migrations In14 Day Free Trial
+