简体   繁体   中英

Files created by php cannot be deleted through FTP

I have searched the web for possible solutions but it seems to make me more and more stuck.

Once a file is created by PHP that file cannot be deleted, other files in the same directory can be deleted. If a directory is created by PHP the whole directory cannot be used by FTP, I can see the files in that directory, but cannot delete, modify or upload to this directory.

I do see a lot of these questions here but mostly they involve permission problems, in this case all permissions, umask and attributes are the same as a file that can be deleted on through FTP.

I also thought it might be that the file is in use, however this is not the case, (lsof results empty, killing apache and nginx, which normally releases the file did not help either).

The server is running PLESK 11.0.9 FTP server is ProFTPD.

Is this some limitation that is caused by PHP, PLESK or is it in ProFTPD itself?

I hope you can help me with it, as I'm quite getting frustrated. If you have any questions that might help in answering this question, feel free to ask :).

[ EDIT ] Some more details why I think it is not a permission problem.

[root@srv domains]# lsattr
-------------e- ./test
-------------e- ./test2

[root@srv domains]# ls -als 
total 32 
4 drwxrwxrwx.  7 user0041 psacln  4096 Mar 22 06:41 . 
4 drwxr-x---. 12 user0041 psaserv 4096 Mar 22 07:28 .. 
4 drwxrwxrwx.  2 user0041 psacln  4096 Mar 22 06:30 test
4 drwxrwxrwx.  2 user0041 psacln  4096 Mar 22 06:34 test2

[root@srv domains]# lsof test
[root@srv domains]#

I cannot do anything with the directory test through ftp, but I can do anything with the directory test2

test has been created with mkdir command of php, while test2 has been created through ssh, and has been chowned to the right user.

Also I removed some unrelated entries from the outputs

More information about the user proftpd runs when logged in:

[root@srv domains]# ps aux | grep ftp
10000     8508  0.5  0.0 152192  3684 ?        SNs  08:37   0:00 proftpd: user0041 - x: IDLE
[root@srv domains]# cat /etc/passwd | grep 10000
user0041:x:10000:505::/var/www/vhosts/domain.ltd:/bin/false

For privacy matters I have changed the domain name to domain.ltd.

Looks like your FTP user doesn't have permissions to delete anything created by the user that PHP is running as. You'll need to contact your hosting company regarding this.

most likely a user permission problem. but it could help if you posted some use case with more details describing what exactly are you doing (file names,process,...)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM