Fixing File and Folder Permission on suPHP

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

cd /var/cpanel/users
for user in *
chown -R $user.$user /home/$user/public_html/*

This script fix all ownership issue


About piyecarane

Bla bla bla about me
This entry was posted in CPANEL, Hosting, Linux and tagged , , . Bookmark the permalink.

3 Responses to Fixing File and Folder Permission on suPHP


    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!

  2. DBI Hosting says:

    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

  3. Adam says:

    find /home/*/public_html -name ‘*.php’ -o -name ‘*.php[345]‘ -o -name ‘*.phtml -exec chmod 644 {} \;
    We received that from our host: and it worked to fix the permissions on our server.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s