Fixing File and Folder Permission on suPHP
August 19, 2008
Just for my own note ![]()
After installing suPHP on server, execute :
find /home/*/public_html -type d -exec chmod 755 {} \;
This command fix all folder permission
find /home/*/public_html -name '*.php' -o -name '*.php[345]' -o -name '*.phtml'| xargs chmod -v 644
This command fix all file permission
#!/bin/bash
cd /var/cpanel/users
for user in *
do
chown -R $user.$user /home/$user/public_html/*
done
This script fix all ownership issue




January 4, 2009 at 2:10 am
THANK YOU THANK YOU THANK YOU!
I’ve been pulling my hair out for a couple days trying to get my scripts to work with suphp turned on. This simple script you put up to change permissions on the folders did the trick.
The third script worked for me as well, but the second script left me at a prompt like this: >
seemed to be waiting for input. When I saved it as a shell script I got an error too, something like “unexpected termination”
Still my scripts are working, thank you for posting that!
February 22, 2009 at 9:32 pm
Retroflick.com
The reason you are getting the prompt is because that command has mixed quotes that do not properly terminate.
The original command had parts of the option quoted with ‘ and terminated with ‘
The correct command is:
find /home/*/public_html -name ‘*.php’ -o -name ‘*.php[345]‘ -o -name ‘*.phtml’| xargs chmod -v 644