When I maintain the blog file today, I found that I can't delete some folders and files in the website path through FTP. FTP prompt Permission Denied (no permission) makes me puzzled. I started looking for my own research ideas. Solution, since the FTP prompt permissions are insufficient, then it should be the problem in the file permissions setting of the server. I go to the server management background to view the file manager. The file manager displays the following figure:
It can be seen that the file owner generated by the PHP
program is the Apache account instead of my ftp account, so the Apache account has all the permissions to control these files but the FTP users do not, so I use my own on FTP. The user will delete the file system and will prompt me to delete them.
In order to determine the problem, I went to consult the server provider again. The answer is completely proof of my inference: general domestic Linux virtual host Apache and ftp are usually not in a user group, so the directory or file ftp created by apache can not be deleted, you must use php program to delete through Apache except.
How to solve it? Very simple, write a PHP program to complete this work
?php/* Linux Space File Remover Version 1.0 Copyright: Free Software, Random Spread# ###报警#### This software is a space maintenance tool. Please delete this file immediately after use. */?!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http: //www.w3.org/TR/html4/loose.dtd"htmlheadmeta http-equiv="Content-Type" content="text/html; charset=utf-8"titlespace folder/file removal tool/Titlestylebody {font-family:"宋体"; font-size:12px;}imput { border:1px #ccc solid;}b { color:#FF0000;}/style/headbodyform action="?action=dirdel" Method="post"Delete folder, bPlease make sure to fill in the correct operation after deleting it! /bbr Please enter the folder path, please use ";" separate input type="text" name ="all_folder" size="50"input type="submit" value="delete"/formbrform action="?action=filedel " method="post"Delete files, bPlease make sure to fill in the correct operation! /bbr Please enter the full file path, please use ";" separate input type="text" Name="all_files" size="50"input type="submit" value="delete"/formbr?php$action = $_GET['action'];//delete directory operation if($action =='dirdel') { $all_folder = $_POST['all_folder']; if(!empty($all_folder)) { //Recognize multiple folders by semicolon $folders = explode(';',$all_folder) ; if(is_array($folders)) { foreach($folders as $folder) { deldir($folder); echo $folder . 'Delete successful Br'; } } }}}if($action=='filedel') { $all_files = $_POST['all_files']; if(!empty($all_files)) { //Identifies multiple files by semicolon $files = explode(';',$all_files); if(is_array($files) { foreach($files as $file) { if(is_file($file)) { if(unlink($file)) { echo $file . 'Delete successful Br'; } else { echo $file . 'Cannot delete, Please check the permissions Br'; } } Else { echo $file . 'Do not exist br'; } } } }}//Delete directory and include file functions function deldir($dir) { //Open file directory $dh = opendir($dir); //loop Read the file while ($file = readdir($dh)) { if($file != '.' $file != '..') { $fullpath = $dir . '/' . $file; //Judge Is it a directory if(!is_dir($fullpath)) { //If not, delete the file if(!unlink($fullpath)) { echo $fullpath . 'Cannot delete, there may be no permissions! br'; } } else { //If it is a directory, recursively delete the subdirectory deldir($fullpath); } } } //close the directory closedir($dh); //delete the directory if(rmdir($dir)) { return true; } else { Return false; }}?/body/html
Redis is an open source, log-based, Key-Value database that is written in ANSI C, supports networki
2011 is the 20th anniversary of Linux and the 18th anniversary of the Debian release. Linux has expe
for Windows 7 computers Microsoft will allow its computer OEMs and their system co-developers to d
Or from the process of compiling the link to generate vmlinux, it is made up of a bunch of .o files
Linux message queue programming example
Linux Tips: Introduce two ways to modify port 22
CenterOS 64-bit mysql5.5.25 to open remote access function
Open vpn installation diagram detailed tutorial
Nagios nrpe process can't start problem
Linux installation using cacti
Linux common compression decompression command set
Neighbor subsystem of linux protocol stack (related process 3)
Windows 8 is not up to expectations
How to recover from the Win7 start menu without running bar?
The difference between URL forwarding "hidden" and "not hidden"
How to apply for yy live room? Yy live room application method introduction
How to use Win7 notebook as a wireless router
How Win8 limits the use of disk to protect disk space
How to install Win10 system using u disk
Win10 RS2 Quick Preview Edition 14931 feedback center ushers in dark theme
How to open the built-in firewall win10? Win10 firewall open method
Win7 system encountered a boot prompt "password has expired" how to solve the problem