Guest Geoff Posted December 15, 2010 Posted December 15, 2010 Account details: username:gfishing domain:geoffish.heliohost.org Problem: I cannot remove the directory "/home/gfishing/public_html/drupal". I get permission denied errors, and other related problems when attempting to remove the directory via CPanel or FTP. This is really weird, because I have never had this problem before. Just trying to install CMS (don't trust softalicious), and I attempted to move my installation to my document root, but could not. If you could just remove the directory above for me, everything should be fine, unless I get more similar problems. Thanks, Geoff
Byron Posted December 16, 2010 Posted December 16, 2010 Try running this perl script and don't forget to chmod it to 755. #!/usr/bin/perl -w print "Content-Type: text/html\n\n"; system 'rm -r "/home/gfishing/public_html/drupal" 2>&1';
Guest Geoff Posted December 16, 2010 Posted December 16, 2010 I get the following error: rm: cannot remove `/home/gfishing/public_html/drupal/sites/default/default.settings.php': Permission denied rm: cannot remove directory `/home/gfishing/public_html/drupal/sites/default/files': Permission denied rm: cannot remove `/home/gfishing/public_html/drupal/sites/default/settings.php': Permission denied See for yourself here.
Byron Posted December 16, 2010 Posted December 16, 2010 This support request is being escalated to our root admin.
Ashoat Posted December 16, 2010 Posted December 16, 2010 The folder "public_html/drupal/sites/default" had its permissions set to 555, preventing you from deleting it. In addition, the files "settings.php" inside the aforementioned folder was set to 444. After correcting both these settings, I was able to delete the folder.
Guest Geoff Posted December 16, 2010 Posted December 16, 2010 Thanks Edit: Here is the script for my own convenience if it is deleted: <?php function deleteDir($dir) { // open the directory $dhandle = opendir($dir); if ($dhandle) { // loop through it while (false !== ($fname = readdir($dhandle))) { // if the element is a directory, and // does not start with a '.' or '..' // we call deleteDir function recursively // passing this element as a parameter if (is_dir( "{$dir}/{$fname}" )) { if (($fname != '.') && ($fname != '..')) { echo "<u>Deleting Files in the Directory</u>: {$dir}/{$fname} <br />"; deleteDir("$dir/$fname"); } // chmod all directories and files correctly // the element is a file, so we delete it } else { chmod("$dir", intval(0755, 8)); chmod("{$dir}/{$fname}", intval(0644, 8)); unlink("{$dir}/{$fname}"); echo "Deleting File: {$dir}/{$fname} <br />"; } } closedir($dhandle); } // now directory is empty, so we can use // the rmdir() function to delete it echo "<u>Deleting Directory</u>: {$dir} <br />"; rmdir($dir); } // call deleteDir function and pass to it // as a parameter a directory name deleteDir("/home/username/public_html/delete"); ?>
Byron Posted December 16, 2010 Posted December 16, 2010 Just incase that happens again I just modified this php script to recursively chmod all files and folders (including sub-folders & files) to the correct permissions and then delete folder and files (incuding sub-folders & files). http://byrondallas.heliohost.org/temp/recu...files_chmod.txt Be careful when runing this script. There is no recovering of files after the script is run.
Ashoat Posted December 20, 2010 Posted December 20, 2010 Thanks for the scripts, guys! Locking thread...
Recommended Posts