Posted by: Mangesh_Linux_Administrator | November 17, 2010

SuPHP fix file/directory permissions & ownership issue

How to verify Suphp is configured or not?? (Cpanel server)

# /usr/local/cpanel/bim/rebuild_phpconf –current

SuPHP fix file/directory permissions & ownership issue

After installing suPHP on server, execute :

This command fix all folder permission
# find /home/*/public_html -type d -exec chmod 755 {} \;

This command fix all file permission
# find /home/*/public_html -name ‘*.php’ -o -name ‘*.php[345]’ -o -name ‘*.phtml’| xargs chmod -v 644

This script fix all ownership issue

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



  1. Your script to fix ownership issues would not work under circumstances where there are cPanel accounts on /home2.

  2. What if someone does (or that dir has other strange files):

    touch /var/cpanel/users/uhoh

    I think ideally you should get that data from the cPanel API.

    • Also, you could have cPanel accounts on /home , /home2, /home3 all at once on the same machine. You should get the partition from the cPanel API as well.

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


%d bloggers like this: