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.
Download the fix perms script
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
More from cPanel
How To Install A Cloudflare Origin SSL Certificate In cPanel
Free SSL Certificates from places like cPanel or Let's Encrypt are great. When Let's Encrypt first introduces free SSL Certificates …
Create a SWAP partition on CentOS, RHEL and AlmaLinux without a reboot
SWAP is a memory type that Linux NVMe VPS Servers use to process requests. Memory will be held in SWAP …
Help fixing Error: last request failed: [AUTH] Authentication failed.
The Error: last request failed: [AUTH] Authentication failed error can be caused by a range of things. It could be …