Work:FixPerm Script Command Line

From Zoelife4U Wiki
Jump to: navigation, search

Command Line Version

Written by Joe Crown
Modified by John D Jones III

Put this in $HOME and execute on the command line (within SSH):
Removed All Dos2Unix code, too many corrupted binary files.

   #php fixperm.php
<?php
// This code is licensed under the GPL Version 2.0 only
// Make sure you name the file with the .php extension
// or one that is run as php.
// This script now allows it"s file name to be anything,
// so long as it is run through the php parser.
// This is Version 1.4.1
 
echo "<!-- This code is licensed under the GPL Version 2.0 only -->\n";
 
	echo "\nFixing permissions on Files & Folders.";
	echo "\nSetting folders to 755 & files to 644. ";
	system ("find public_html/ -type d -exec chmod 755 {} \;");
	system ("find public_html/ -type f -exec chmod 644 {} \;");
	echo "\nFixing Line Endings of all files with dos2unix ";
        // Removed Dos2Unix, caused to much problems with binary files..
	echo "\nDone.";
	echo "\nSetting .cgi & .pl files to 755. ";
	system ("find public_html/ -name \*.cgi -exec chmod 755 {} \;");
	system ("find public_html/ -name \*.pl -exec chmod 755 {} \;");
	system ("find public_html/ -name \*.pm -exec chmod 755 {} \;");
	echo "\nDone.";
	echo "\nAlso setting .ftpquota files to 600. ";
	system ("find public_html/ -name .ftpquota -exec chmod 600 {} \;");
	echo "\nDone.\n\n";
?>
Personal tools
Online Users
Zoelife4U: