This is assuming you run a webserver and php as www-data (or the www equivalent) and that the owner of the files is one up from there (example /home/username/www/ is owned by username with the group of www-data).
Can quickly set all folders to 750 and all files to 740 with the following commands (or whatever octal numbers you need)
Code:
cd /home/username/www/
find . -type d -print0 |xargs -0 chmod 750
find . -type f -print0 |xargs -0 chmod 640
first find row will find from the current directory you're in all directories and then set their permissions to 750 (read/write/exec for owner/user, read/execute for group, nothing for 'other')
and the next find row would find all files recursively and set their permissions to 640 (read/write for user/owner, read for group, nothing for 'other')
Just something I thought of doing in light of securing WHMCS
for example if I moved the attachment, downloads, and template_c folder out of the WHMCS installation folder, and the configuration.php is already set, then all folders and files in the WHMCS installation path should be fine at 750/640 (or 755 and 644 depending on your server configuration).
My web services run as www-data (nginx and php), and the files are owned by a specific user as a part of that group, so technically there is no reason why any user/group outside of that should have access to those files, hence the zero for the 'other' octal.
Your milage may vary. But those commands will recursively set only-dirs and only-files to whatever octal value you choose as a starting point.