Oct 072013
 

Here are a few one liners to change the perms needed when switching to suphp. The following commands will look in every user’s html folder and make the appropriate chmod to allow php to properly execute under SuPHP.

* For Directories
find /home/*/public_html/ -type d -print0 | xargs -0 chmod 0755
* For Files
find /home/*/public_html/ -type f -not -name "*.pl" -not -name "*.cgi" -not -name "*.sh" -print0 | xargs -0 chmod 0644
* For CGI/Scripts
find /home/*/public_html/ -type f -name "*.cgi" -print0 -o -name "*.pl" -print0 -o -name "*.sh" -print0 | xargs -0 chmod 0755
  
Don’t forget to check for files owned by ‘nobody’ or ‘root’ — they will also fail with a 500 error. The following Perl script will eliminate nobody/root ownership. Place the Perl script into your /home directory and execute it.

#!/usr/bin/perl -w

my @dirs = grep -d,< *>;

foreach my $user (@dirs) {
`chown -R $user:$user $user/public_html/*`;
}

 Posted by at 6:09 am

Sorry, the comment form is closed at this time.