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

#!/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

Advertisements

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

  1. 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!

  2. DBI Hosting says:

    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

  3. Adam says:

    Try
    find /home/*/public_html -name ‘*.php’ -o -name ‘*.php[345]‘ -o -name ‘*.phtml -exec chmod 644 {} \;
    We received that from our host: http://itxdesign.com 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:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s